無法 ping 通同一子網路中的兩台設備

無法 ping 通同一子網路中的兩台設備

需要一些路由方面的幫助。我不明白如何進行這項工作

我配置了 2 個設備。其中一台設備(某個盒子1)配置 2 個接口,路由表如下所示

[2018-08-24 00:29:14 root@somebox1: /home/admin ]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.4.1      0.0.0.0         UG    0      0        0 eth0
192.168.4.0      0.0.0.0         255.255.254.0   U     0      0        0 eth0
192.168.6.0      0.0.0.0         255.255.254.0   U     0      0        0 eth1

因此,在此框中,對於其中兩個接口,添加了 192.168.4.x 和 192.168.6.x 的路由規則。它們都是 CIDR /23 的一部分

預設通過 192.168.4.1。

我有另一個設備(一些盒子2)在子網路 192.168.6.x 上配置單一介面。它的路由表如下所示

[2018-08-24 04:54:31 admin@somebox2: ~ ]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.6.1      0.0.0.0         UG    0      0        0 eth0
192.168.6.0      0.0.0.0         255.255.254.0   U     0      0        0 eth0

現在。我遇到一個困難,從 somebox2 無法 ping 通 somebox1 的 eth0 IP。

[2018-08-25 04:55:47 root@somebox1: /home/admin ]# ping -I eth0 192.168.4.120
PING 172.29.4.120 (172.29.4.120) from 192.168.6.21 eth0: 56(84) bytes of data.
^C
--- 172.29.4.120 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms

但我可以 ping somebox1 的預設網關

[2018-08-25 04:55:32 root@somebox1: /home/admin ]# ping -I eth0 192.168.4.1
PING 172.29.4.1 (172.29.4.1) from 192.168.6.21 eth0: 56(84) bytes of data.
64 bytes from 192.168.4.1: icmp_seq=1 ttl=255 time=0.498 ms
64 bytes from 192.168.4.1: icmp_seq=2 ttl=255 time=0.701 ms
^C
--- 172.29.4.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1

從 somebox1 中,我可以使用 eth1 介面 ping somebox2 的 eth0 IP

bash-4.2$ ping -I eth0 192.168.6.21
PING 192.168.6.21 (192.168.6.21) from 192.168.4.120 eth0: 56(84) bytes of data.
^C
--- 192.168.6.21 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 2999ms

bash-4.2$ ping -I eth1 192.168.6.21
PING 192.168.6.21 (192.168.6.21) from 192.168.6.44 eth1: 56(84) bytes of data.
64 bytes from 192.168.6.21: icmp_seq=1 ttl=64 time=1.64 ms
64 bytes from 192.168.6.21: icmp_seq=2 ttl=64 time=0.789 ms
64 bytes from 192.168.6.21: icmp_seq=3 ttl=64 time=0.635 ms
^C
--- 192.168.6.21 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.635/1.022/1.643/0.444 ms

如果我在 somebox1 上刪除了 192.168.6.0 的路由表條目,或者完全刪除了 eth1(192.168.6.x) 的接口,那麼我可以從 somebox2 ping 到 somebox1,沒有任何問題。

另外,我可以查看 somebox2 是否配置了介面 192.168.4.x 或 192.168.2.x 或 192.168.12.x,我可以 ping somebox1 的 eth0 IP,沒有任何問題。只有在 somebox2 上配置了 192.168.6.x 時,我才無法 ping somebox1 的 eth0 IP 但是,我能夠 ping 192.168.6.x 網路上的 somebox1 的 eth1 IP,沒有任何問題

問題:

1. Is removing the Interface or Routing table for eth1 from somebox1 the only way i can ping from somebox2 to somebox1
2. Why is that with the same interface i am facing this hurdle of not able to ping. Is it to do with the Routing table configuration on somebox1

相關內容