当我从交换机发出 ping 192.168.1.200 时,我发现 ICMP 请求数据包的 IP 标头中的源 IP 是 1.1.1.2,但 L2 标头中的源 MAC 是 MAC2,数据包通过 Port2 发送到 Eth1。在这种情况下,CentOS 没有 ICMP 回复。然而,如果 ICMP 请求中的 IP 和 MAC 都是 Port2 的(使用 ping 命令中的选项来指定),CentOS 将正确回复。
我怀疑在第一种情况下,内核完成了一些验证工作,并且由于不匹配而导致数据包被丢弃。但我找不到证据。有人知道这个吗?如果是这种情况,如果可能的话,请指出相关的源例程。多谢!
CentOS的内核版本是3.10.0。
network settings as following:
============================Cent7.x============================
[root@CentOS ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.1.1.1 netmask 255.255.255.0 broadcast 1.1.1.255
inet6 fe80::201:edff:fefc:56fa prefixlen 64 scopeid 0x20<link>
ether 00:01:ed:fc:56:fa txqueuelen 1000 (Ethernet)
RX packets 139 bytes 16868 (16.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 44 bytes 5324 (5.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 2.2.2.1 netmask 255.255.255.0 broadcast 2.2.2.255
inet6 fe80::201:edff:fefc:56fb prefixlen 64 scopeid 0x20<link>
ether 00:01:ed:fc:56:fb txqueuelen 1000 (Ethernet)
RX packets 250 bytes 31688 (30.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 7524 (7.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.202 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::201:edff:fefc:56fc prefixlen 64 scopeid 0x20<link>
ether 00:01:ed:fc:56:fc txqueuelen 1000 (Ethernet)
RX packets 3000 bytes 500249 (488.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9054 bytes 12030772 (11.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@CentOS ~]# ip route
1.1.1.0/24 dev eth0 proto kernel scope link src 1.1.1.1 metric 100
2.2.2.0/24 dev eth1 proto kernel scope link src 2.2.2.1 metric 101
192.168.1.0/24 dev eth2 proto kernel scope link src 192.168.1.202 metric 102
[root@CentOS ~]#
[root@CentOS ~]# arp
Address HWtype HWaddress Flags Mask Iface
1.1.1.2 ether 12:31:23:12:31:2f C eth0
2.2.2.2 ether 12:31:23:12:31:41 C eth1
192.168.1.150 ether a0:36:9f:a0:d9:6e C eth2
============================Switch============================
[lsw]ip routing-table:
Destinations : 17 Routes : 18
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.0/24 Direct 0 0 1.1.1.2 Vlan2
1.1.1.0/32 Direct 0 0 1.1.1.2 Vlan2
1.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.255/32 Direct 0 0 1.1.1.2 Vlan2
2.2.2.0/24 Direct 0 0 2.2.2.2 Vlan20
2.2.2.0/32 Direct 0 0 2.2.2.2 Vlan20
2.2.2.2/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.255/32 Direct 0 0 2.2.2.2 Vlan20
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.202/32 Static 50 0 1.1.1.1 Vlan2
2.2.2.1 Vlan20
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
[lsw]arp
Type: S-Static D-Dynamic O-Openflow R-Rule M-Multiport I-Invalid
IP address MAC address VLAN/VSI name Interface Aging Type
1.1.1.1 0001-edfc-56fa 2 XGE1/1/1 293 D
2.2.2.1 0001-edfc-56fb 20 XGE1/1/2 724 D