虚拟机设置网络设置选择“桥接模式”
在centos虚拟机里一次修改下面三个文件内容
vi /etc/sysconfig/network-scripts ----------------- TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=这里我删了 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.0.10 GATEWAY=192.168.0.1 NETMASK=255.255.255.0 DNS1=192.168.0.1 DNS2=8.8.8.8 -------------------------
vi /etc/resolv.conf
------------------------
# Generated by NetworkManager
nameserver 192.168.0.1
nameserver 8.8.8.8
--------------------------
vi /etc/hosts
-----------------------
127.0.0.1 localhost
192.168.0.10 master master.root
192.168.0.20 slave1 slave1.root
192.168.0.30 slave2 slave2.root
------------------------
重启网卡 service network restart 便可以ping通百度了