VMware HostOnly 虚拟机上网配置
--------------
1
主机: Windows
虚拟机: RedHat4 AS
2
主机通过小区宽带上网. 小区宽带做了IP/MAC绑定限制.
3
Host Only
[STEP]
VMware | 编辑 | 虚拟网络编辑器
配置为HOST ONLY,
一定要是VM1, DHCP可不开启.
其它不用的网络删除.
检查IP网段,这个IP作为虚拟机的网关IP.
虚拟机HOST ONLY正常情况是不能连接外网的, 若要连接外网, 拔号连接必须开共享,并且选择目标为VM1.
选择HOST ONLY.
配置IP,主要配置IP与网关.
[root@redhat4 /]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:FC:4C:AF
ONBOOT=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.200
USERCTL=no
PEERDNS=yes
GATEWAY=192.168.1.1
IPV6INIT=no
[root@redhat4 /]#
配置DNS
[root@redhat4 /]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 8.8.8.8
nameserver 8.8.8.4
[root@redhat4 /]#
重启网络
[root@redhat4 /]# /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Setting network parameters: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@redhat4 /]#
断开拔号,重新连接
测试连接
[root@redhat4 /]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=47 time=13.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=47 time=13.6 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 2 received, 33% packet loss, time 2001ms
rtt min/avg/max/mdev = 13.684/13.684/13.684/0.000 ms, pipe 2
[root@redhat4 /]#
最后记得关掉或设置虚拟机和本地机的防火墙!
OK!