Linux桥接器不回应ARP数据包

我想设置一个testing场景,我需要一个完整的虚拟IP协议栈。 基本上,我想模拟虚拟机(或容器)和它的主机之间的networking,没有虚拟机,即虚拟化层。

主机端是一个具有configuration的IP地址(模拟虚拟机的默认gw)的网桥( br0 ),正如在其他工作的KVM设置中所见。 我试图模拟连接的VM端,如下所示:

  • 使用tap界面(OpenVPN连接到另一台服务器,从那里ping)
  • 一端configuration一个IP地址,另一端连接到网桥
  • 一个IP地址通过veth对连接到主桥的二级bridge

在这些设置中,我都无法ping通主桥(VM默认的gw)。 在所有的设置中,问题都是一样的:网桥接口没有响应ARP数据包。

configuration(本地veth):

  +-----+ | br0 | | | +------+ +------+ | ==| vip1 |<-->| vip2 | +-----| +------+ +------+ br0: type=bridge, UP, 172.16.1.1/24 vip1: type=veth, UP vip2: type=veth peer, UP, 172.16.1.2/24 # brctl addbr br0 # ifconfig br0 172.16.1.1 netmask 255.255.255.0 up # ip link add vip1 type veth peer name vip2 # ifconfig vip2 172.16.1.2 netmask 255.255.255.0 up # brctl addif br0 vip1 # ifconfig vip1 up 

现在我试图从vip2 ping br0

  # [root@host ~]# ping -I vip2 172.16.1.1 # PING 172.16.1.1 (172.16.1.1) from 172.16.1.2 vip2: 56(84) bytes of data. # ^C # --- 172.16.1.1 ping statistics --- # 2 packets transmitted, 0 received, 100% packet loss, time 1493ms 

桥上的tcpdump

  # [root@host ~]# tcpdump -i br0 # tcpdump: verbose output suppressed, use -v or -vv for full protocol decode # listening on br0, link-type EN10MB (Ethernet), capture size 65535 bytes # 23:14:02.367624 ARP, Request who-has 172.16.1.1 tell 172.16.1.2, length 28 # 23:14:03.367657 ARP, Request who-has 172.16.1.1 tell 172.16.1.2, length 28 # 23:14:04.367345 ARP, Request who-has 172.16.1.1 tell 172.16.1.2, length 28 # ... 

这很奇怪,因为这些数据包到达的br0接口是UP ,应该响应ARP请求。

  # [root@host ~]# ifconfig br0 # br0 Link encap:Ethernet HWaddr F6:F3:5A:A7:A2:5B # inet addr:172.16.1.1 Bcast:172.16.1.255 Mask:255.255.255.0 # inet6 addr: fe80::f4f3:5aff:fea7:a25b/64 Scope:Link # UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 # RX packets:53 errors:0 dropped:0 overruns:0 frame:0 # TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 # collisions:0 txqueuelen:0 # RX bytes:1580 (1.5 KiB) TX bytes:360 (360.0 b) 

我试过了:

  • OpenVPN的点击界面(通过OpenVPN从另一台主机ping,所以数据包到达点击界面与veth界面)
  • 另一个桥( br1 ),使用veth对连接两个桥
  • 设置net.ipv4.conf.all.arp_filter和其他,但nothings似乎有影响
  • iptablesebtables是空的,并接受一切。

所以我正在努力找出为什么这不起作用,与容器或虚拟化解决scheme有什么不同。 任何帮助,高度赞赏!

谢谢!