大网数据广告活动
服务器运维问答

ARP table emptied when TAP interface is added to bridge

· 52CE 我爱测

I have a problem with ARP table on CentOS. Sometimes, when I create a TAP interface and add it to a bridge, the ARP table is cleared up. E.g. when I execute this command: sudo ip tuntap add dev tap-device-u98 mode tap; sudo ip li…

问题原文

原帖链接 · Nathan · CC BY-SA 4.0

I have a problem with ARP table on CentOS. Sometimes, when I create a TAP interface and add it to a bridge, the ARP table is cleared up.

E.g. when I execute this command:

sudo ip tuntap add dev tap-device-u98 mode tap; sudo ip link set dev tap-device-u98 master br0

the ARP table drops to just several entries.

It happens too when I do:

sudo ip link set dev tap-device-u98 nomaster

Most of the entries in the ARP table are permanent and managed by a home-made dedicated application (for our specific needs). They can hold up to 12k entries, but the amount is not relevant (it happens as well with large table (12k) as with small ones (10)).

This happens on most of our servers, from CentOS6.2 to CentOS7.8.

The exact issue occurs in production isn't with the above commands, but with openvpn (to create the TAP interface) and brctl (to add the interface to the bridge). But it seems to be irrelevant, as the issue also happens with 'ip'. The PoC with 'ip' commands was executed on a CentOS 7.4.1708 with kernel 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017

/var/log/messages doesn't help very much:

--- (Create interface and mount it on br0)
Nov 26 15:52:51 localhost NetworkManager[733]: <info>  [1606402371.7604] manager: (tap-device-u98): new Tun device (/org/freedesktop/NetworkManager/Devices/2723)
Nov 26 15:52:51 localhost kernel: br0: port 7(tap-device-u98) entered blocking state
Nov 26 15:52:51 localhost kernel: br0: port 7(tap-device-u98) entered disabled state
Nov 26 15:52:51 localhost kernel: device tap-device-u98 entered promiscuous mode
--- (Remove interface from br0 and delete it)
Nov 26 15:52:51 localhost kernel: device tap-device-u98 left promiscuous mode
Nov 26 15:52:51 localhost kernel: br0: port 7(tap-device-u98) entered disabled state
Nov 26 15:52:51 localhost NetworkManager[733]: <info>  [1606402371.8909] device (tap-device-u98): released from master device br0

Any ideas of what could go wrong?

已采纳解答

原帖链接 · Nathan · CC BY-SA 4.0

For the record, I'm posting the answer here.

Because of the way the MAC address of the bridge is calculated, adding or removing interfaces to/from it can trigger the recalculation of the MAC address (function br_stp_recalculate_bridge_id from br_stp_if.c).

So, because the bridge didn't had a fixed MAC address, it might be regenerated, which lead to an ARP drop.

To fix the issue, simply fix the MAC address, then:

sudo vim /etc/sysconfig/network-scripts/ifcfg-br0
    [...]
    MACADDR=xx:xx:xx:xx:xx:xx

sudo ifdown br0
sudo ifup br0

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-11-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。