Linux Bridge Command Examples

The 'brctl' utility from the bridge-utils package has been deprecated for some time, in favour of the 'bridge' command that comes as part of iproute2.

How to use the commands to get information on Linux bridges is not as clear, so I'm jotting down some quick one liners, mostly to help me remember.

NOTE: The '-br' on the 'ip' commands is for 'brief' output, they can be run without this to show more verbose information. You can use '-br' with all 'ip' commands, it's nothing to do with bridges.

Show bridges configured on the system

ip -br link show type bridge

me@server:~$ ip -br link show type bridge
private          UP             4c:d9:8f:6d:a9:70 <BROADCAST,MULTICAST,UP,LOWER_UP> 
public           UP             4c:d9:8f:6d:a9:70 <BROADCAST,MULTICAST,UP,LOWER_UP> 

Show interfaces that are part of a given bridge

ip -br link show master <bridge_name>

me@server:~$ ip -br link show master private
eno1             UP             4c:d9:8f:6d:a9:70 <BROADCAST,MULTICAST,UP,LOWER_UP> 
tap0             UNKNOWN        fe:d9:bb:17:47:9c <BROADCAST,MULTICAST,UP,LOWER_UP> 
tap2             UNKNOWN        fe:b0:9b:fb:5e:e3 <BROADCAST,MULTICAST,UP,LOWER_UP> 
tap1             UNKNOWN        fe:11:ca:71:89:1e <BROADCAST,MULTICAST,UP,LOWER_UP> 

Display MAC address / forwarding table for a given bridge

bridge fdb show br <bridge_name>

me@server:~$ sudo bridge fdb show br private
4c:d9:8f:af:4d:03 dev eno1 master private 
b0:26:28:dc:10:70 dev eno1 master private 
33:33:ff:48:00:51 dev private self permanent
33:33:ff:6d:a9:70 dev private self permanent
aa:00:00:21:66:df dev tap0 master private 
fe:d9:bb:17:47:9c dev tap0 vlan 1 master private permanent
fe:d9:bb:17:47:9c dev tap0 master private permanent
33:33:00:00:00:01 dev tap0 self permanent
01:00:5e:00:00:01 dev tap0 self permanent

Display MAC addresses learnt on a given bridge port

bridge fdb show br <bridge_name> dev <member_interface>

me@server:~$ sudo bridge fdb show br private dev tap1
aa:00:00:85:fe:67 master private 
fe:11:ca:71:89:1e vlan 1 master private permanent
fe:11:ca:71:89:1e master private permanent
33:33:00:00:00:01 self permanent
01:00:5e:00:00:01 self permanent
33:33:ff:71:89:1e self permanent
01:80:c2:00:00:0e self permanent
01:80:c2:00:00:03 self permanent
01:80:c2:00:00:00 self permanent


You'll only receive email when they publish something new.

More from techtrips
All posts