ARP 答复未通过 Linux Bridge 转发到 TAP 设备

ARP 答复未通过 Linux Bridge 转发到 TAP 设备

创建两个 TAP 设备,每个设备都将由用户空间协议栈进行读写。此外,两个 TAP 设备通过 Linux Bridge 进行桥接。准备环境的脚本如下。

sudo ip tuntap add dev tap0 mode tap
sudo ip tuntap add dev tap1 mode tap

sudo ip addr add 10.0.0.1/24 dev tap0
sudo ip addr add 10.0.0.2/24 dev tap1

sudo ip link set up tap0
sudo ip link set up tap1

sudo brctl addbr br0
sudo brctl addif br0 tap1
sudo brctl addif br0 tap0
sudo ip link set br0 up

用户空间协议栈具有发送和接收ARP的能力。产生这个问题的过程如下。

  1. 从 tap0 发出 ARP 请求。
  2. 它通过 br0 到达 tap1 并抛出 ARP 应答。
  3. br0 收到 ARP 回复,但是没有到达 tap0。

我捕获的数据包如下。

vagrant@impish64:~$ sudo tcpdump -i br0 -nv
tcpdump: listening on br0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:14:23.103549 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.0.0.2 tell 10.0.0.1, length 28
13:14:23.104203 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.0.0.2 is-at 3a:2c:25:5b:e1:40, length 28
vagrant@impish64:~$ sudo tcpdump -i tap0 -nv
tcpdump: listening on tap0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:13:40.868761 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.0.0.2 tell 10.0.0.1, length 28
vagrant@impish64:~$ sudo tcpdump -i tap1 -nv
tcpdump: listening on tap1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:12:50.368294 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.0.0.2 tell 10.0.0.1, length 28
13:12:50.368699 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.0.0.2 is-at 3a:2c:25:5b:e1:40, length 28

该问题的示意图如下。

图表

tap0为什么使用此设置ARP Reply 不起作用?

相关内容