Routes ping失败,主路由表中没有条目

Routes ping失败,主路由表中没有条目,routes,ping,Routes,Ping,如果删除主表中的路由条目,Ping失败 以下是网络情况: [root@localhost ~]# ip a s dev eth1 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:1e:67:64:ee:b8 brd ff:ff:ff:ff:ff:ff

如果删除主表中的路由条目,Ping失败

以下是网络情况:

[root@localhost ~]# ip a s dev eth1                                            
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 
    link/ether 00:1e:67:64:ee:b8 brd ff:ff:ff:ff:ff:ff                         
    inet 192.168.19.22/24 brd 192.168.19.255 scope global eth1                 
    inet6 fe80::21e:67ff:fe64:eeb8/64 scope link                               
       valid_lft forever preferred_lft forever 

[root@localhost ~]# ip ro s
default via 192.168.19.254 dev eth1     

[root@localhost ~]# ip ru s
0:      from all lookup 255
32764:  from all to 192.168.19.22 lookup HOST
32765:  from 192.168.19.22 lookup HOST
32766:  from all lookup main
32767:  from all lookup default

[root@localhost ~]# ip ro s t HOST
192.168.19.0/24 dev eth1  scope link  src 192.168.19.22
default via 192.168.19.254 dev eth1

[root@localhost ~]# ping 192.168.19.51 -w 5
PING 192.168.19.51 (192.168.19.51) 56(84) bytes of data.

--- 192.168.19.51 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 4999ms

[root@localhost ~]# ping 192.168.19.51 -I eth1 -w 5                              
PING 192.168.19.51 (192.168.19.51) from 192.168.19.22 eth1: 56(84) bytes of data.

--- 192.168.19.51 ping statistics ---                                            
6 packets transmitted, 0 received, 100% packet loss, time 4999ms          
我知道“-I”和“-r”之间的区别:

-I eth1将使用opt SO_BINDTODEVICE撤销setsockopt

-I 192.168.19.22将撤销约束

-r将用opt SO_DONTROUTE撤销setsockopt

如果在主表中添加路由条目,它将通过:

[root@localhost ~]# ip ro a 192.168.19.0/24 dev eth1          
[root@localhost ~]# ip ro s                                   
192.168.19.0/24 dev eth1  scope link                          
default via 192.168.19.254 dev eth1                           
[root@localhost ~]# ping 192.168.19.51 -c 3                   
PING 192.168.19.51 (192.168.19.51) 56(84) bytes of data.      
64 bytes from 192.168.19.51: icmp_seq=1 ttl=64 time=1.99 ms   
64 bytes from 192.168.19.51: icmp_seq=2 ttl=64 time=0.207 ms  
64 bytes from 192.168.19.51: icmp_seq=3 ttl=64 time=0.435 ms  

--- 192.168.19.51 ping statistics ---                         
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.207/0.879/1.997/0.796 ms            
若主表有一个条目,或使用-I地址ping,或使用-I接口-r ping,它将通过。 但如果使用-I接口ping,则不会

为什么呢?有什么区别

[root@localhost ~]# ip ro a 192.168.19.0/24 dev eth1          
[root@localhost ~]# ip ro s                                   
192.168.19.0/24 dev eth1  scope link                          
default via 192.168.19.254 dev eth1                           
[root@localhost ~]# ping 192.168.19.51 -c 3                   
PING 192.168.19.51 (192.168.19.51) 56(84) bytes of data.      
64 bytes from 192.168.19.51: icmp_seq=1 ttl=64 time=1.99 ms   
64 bytes from 192.168.19.51: icmp_seq=2 ttl=64 time=0.207 ms  
64 bytes from 192.168.19.51: icmp_seq=3 ttl=64 time=0.435 ms  

--- 192.168.19.51 ping statistics ---                         
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.207/0.879/1.997/0.796 ms