有一个设备,让我们称之为1,网络A设备1有两个接口,eth5和eth7网络上有一个设备2,从eth5到设备2,从eth7到设备2,设备2可以平eth5和eth7,但是,从eth5到eth7,反之亦然。
[root@ipfrmk /]# ping -I eth5 192.168.10.42
PING 192.168.10.42 (192.168.10.42) from 192.168.10.43 eth5: 56(84) bytes of data.
^C
--- 192.168.10.42 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2006ms和
[root@ipfrmk /]# ping -I eth7 192.168.10.43
PING 192.168.10.43 (192.168.10.43) from 192.168.10.42 eth7: 56(84) bytes of data.
^C
--- 192.168.10.43 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms我可以在网络A上切换其他设备,但不能分别切换接口。
可能是每个接口的静态路径?
我尝试了下面的命令,但没有运气..
ip route add 192.168.0.0/16 via 192.168.10.42 dev eth5输出
[root@ipfrmk /]# ping -I eth5 192.168.10.42
PING 192.168.10.42 (192.168.10.42) from 192.168.10.43 eth5: 56(84) bytes of data.
From 192.168.10.43 icmp_seq=1 Destination Host Unreachable
From 192.168.10.43 icmp_seq=2 Destination Host Unreachable
From 192.168.10.43 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.10.42 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5002ms
pipe 3一定是我错过了什么吗?
[root@ipfrmk /]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth5
192.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth7
192.168.0.0 192.168.10.42 255.255.0.0 UG 0 0 0 eth5发布于 2021-02-19 03:07:34
在这种情况下,我建议使用IP地址绑定要发送的接口,而不是接口本身(用于配置)。
ping -I <ens5 IP address> <ens7 IP address>ping没有像预期的那样工作,因为结果IPv4数据报的目标IP地址是传递给ping的接口的IP地址,而不是给定的目标IP地址。
我的配置:
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:e0:cc:50 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.10/24 brd 192.168.122.255 scope global ens5
3: ens6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:cd:c9:91 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.20/24 brd 192.168.122.255 scope global ens6这看起来应该有效,但并不是这样:
root@debian:/home/morgan# ping -c 1 -I ens5 192.168.122.20
PING 192.168.122.20 (192.168.122.20) from 192.168.122.10 ens5: 56(84) bytes of data.
--- 192.168.122.20 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 1mstcpdump输出显示了为什么它不工作..。
目标IP地址是ens5接口的地址,而不是传递给ping的预期目标IP (192.168.122.20)。
18:36:17.982917 IP 192.168.122.10 > 192.168.122.10: ICMP host 192.168.122.20 unreachable, length 92当我使用ens5的IP地址时,ping工作:
root@debian:/home/morgan# ping -c 1 -I 192.168.122.10 192.168.122.20
PING 192.168.122.20 (192.168.122.20) from 192.168.122.10 : 56(84) bytes of data.
64 bytes from 192.168.122.20: icmp_seq=1 ttl=64 time=5.17 ms
--- 192.168.122.20 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 2ms
rtt min/avg/max/mdev = 5.165/5.165/5.165/0.000 ms 发布于 2021-01-06 01:28:46
我可能错了..。但这是发夹转弯吗?它可能无法以这种方式回到自己的身边。有时候,它不可能像那样在同一个界面上来回运行。
https://serverfault.com/questions/1048728
复制相似问题