vmware workstation使用NAT模式联网
指尖二进制 • 1 年前 • 1001 次点击 • OTHER
准备环境: vmware workstation软件,
电脑可以上网,虚拟机使用ip地址
1:电脑本地网络配置
静态ip或无线网都可以
3:进入虚拟机,设置虚拟机地址
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=static
DEVICE=eth0
ONBOOT=yes
IPADDR=10.0.0.11
NETMASK=255.255.255.0
GATEWAY=10.0.0.254
DNS1=8.8.8.8
DNS2=114.114.114.114
[root@localhost ~]# /etc/init.d/network restart
测试
[root@localhost ~]# ping -I eth0 www.baidu.com -c4
PING www.a.shifen.com (39.156.66.18) from 10.0.0.11 eth1: 56(84) bytes of data.
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=1 ttl=128 time=6.66 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=2 ttl=128 time=7.75 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=3 ttl=128 time=7.50 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=4 ttl=128 time=7.63 ms
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 6.664/7.388/7.758/0.436 ms