主机网段:10.0.0.0/24
[root@nfs01 ~]# ping baidu.com ping: baidu.com: Name or service not known 测试虚拟机到网关是否可通 [root@nfs01 ~]# ping 10.0.0.254 PING 10.0.0.254 (10.0.0.254) 56(84) bytes of data. 64 bytes from 10.0.0.254: icmp_seq=1 ttl=128 time=0.274 ms 64 bytes from 10.0.0.254: icmp_seq=2 ttl=128 time=0.513 ms 64 bytes from 10.0.0.254: icmp_seq=3 ttl=128 time=0.349 ms2.检查虚拟机网络配置
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no NAME=ens33 #网卡名称 DEVICE=ens33 #设备名称 ONBOOT=yes #开机自启动 IPADDR=10.0.0.31 #IP地址 PREFIX=24 #掩码 GATEWAY=10.0.0.254 #网关 DNS=114.114.114.1143.重启网卡、配置nameserver
[root@nfs01 ~]# vim /etc/resolv.conf # Generated by NetworkManager nameserver 8.8.8.8 nameserver 8.8.4.4 [root@nfs01 ~]# systemctl restart network [root@nfs01 ~]# ping baidu.com PING baidu.com (39.156.69.79) 56(84) bytes of data. 64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=128 time=17.0 ms 64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=128 time=387 ms