外网eth0:10.0.0.0 内网eth1:172.16.1
报错截图
[root@slb-5 ~]#ping www.baidu.com ping: www.baidu.com: Name or service not known
尝试方法:ping 10.0.0.254网关,宿主机ping外网,ping172.16.1网段IP,都是通的
但是:
内网配置错了,多了网关和DNS
[root@CentOS7-Template ~]#cat /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE=Ethernet BOOTPROTO=none NAME=eth0 DEVICE=eth0 ONBOOT=yes IPADDR=10.0.0.100 PREFIX=24 GATEWAY=10.0.0.254 DNS1=223.5.5.5
解决办法,删除内网网关,DNS,重启网络
[root@CentOS7-Template ~]#cat /etc/sysconfig/network-scripts/ifcfg-eth1 TYPE=Ethernet BOOTPROTO=none NAME=eth1 DEVICE=eth1 ONBOOT=yes IPADDR=172.16.1.100 PREFIX=24 [root@CentOS7-Template ~]#systemctl restart network [root@CentOS7-Template ~]#ping baidu.com PING baidu.com (110.242.68.66) 56(84) bytes of data. 64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=66.6 ms 64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=128 time=87.4 ms 64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=128 time=99.9 ms