所里有幾台機器沒有辦法ping通網關,但是ping交換機里的其它機器都可以ping通,其它機器ping網關也可以ping通。那么就排出了硬件的故障,主要問題就在問題機器的路由表上了。
看一下路由表
route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
12.12.12.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.10.108.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth1
192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
發現里面並沒有我想要的網關,所以就要添加一個
route add default gw 10.10.88.203 eth0
default一般是0.0.0.0表示任意地址
但是卻發現下面的錯誤
SIOCADDRT: No such process
這是因為我要添加的10.10.88.203跟我主機10.10.108.23不在同一個網段,需要添加一下
route add 10.10.88.203 dev eth0
然后再執行一下上面的命令就可以了
route -n一下就能看到結果,最下面一列就是我們想要的。然后機器就可以完美PING通網關了
Destination Gateway Genmask Flags Metric Ref Use Iface
12.12.12.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.10.108.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth1
0.0.0.0 10.10.88.203 0.0.0.0 UG 0 0 0 eth0
---------------------
原文:https://blog.csdn.net/u013304231/article/details/53319375/