Getting started with Linux: how to display the MAC learning table of Linux Bridge
Q: I want to check the MAC address learning status of the Linux bridge I created using brctl. How can I view the MAC learning table (or forwarding table) of the Linux bridge )?
Linux bridge is the software implementation of the bridge, which is the kernel part of the Linux kernel. Similar to the hardware bridge, the Linux bridge maintains a layer-2 Forwarding Table (also known as MAC learning table, forwarding database, or FDB ), it tracks the correspondence between MAC addresses and ports. When a bridge receives a packet on port N (the source MAC address is X), it records MAC address X in FDB and can arrive from Port N. In this case, when the bridge needs to forward a packet to address X, it can query from FDB to know where the packet is forwarded. Building an FDB is often called "MAC learning" or "learning.
You can use the following command to check the current forwarding table or MAC learning table of the Linux bridge.
- $ Sudo brctl showmacs <bridge-name>
This command displays a list of learned MAC addresses and associated ports. Each entry has a related aging timer attached to it. Therefore, the forwarding entries can be refreshed after a certain period of time to update the MAC learning table to the latest version.
This article permanently updates the link address: