Sub topic 11
Reading the table on a Cisco-style switch and a Linux bridge
This chapter assumes you know what a MAC address is, how a switch learns source addresses, and how it floods, forwards and ages entries. Here you will read the table on two real devices and tie each column back to those behaviors.
What you are looking at
Every switch keeps a table that maps a MAC address to a port. Vendors call it the MAC address table, the CAM table, or on Linux the forwarding database (FDB). The columns differ, but each entry answers the same question: if a frame arrives for this MAC address, which port should it leave from?
A Cisco IOS-style switch
Switch# show mac address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0011.2233.4455 DYNAMIC Gi0/1
1 0011.2233.4466 DYNAMIC Gi0/2
Total Mac Addresses for this criterion: 2
Switch# show mac address-table aging-timeRead each row from left to right:
- Vlan is the VLAN in which the address was learned. The same MAC address can appear in several VLANs, because each VLAN has its own table.
- Mac Address is written in three groups of four hex digits. The address
0011.2233.4455is the same as00:11:22:33:44:55. - Type is
DYNAMICif the switch learned the entry from a source address. Dynamic entries age out.STATICmeans an administrator configured it, and it never ages. - Ports is the egress port for frames sent to that address.
The aging-time command shows how long an idle dynamic entry is kept. The default is usually 300 seconds. A frame from that source resets the timer.
Useful filters narrow the output:
show mac address-table address 0011.2233.4455looks up one host.show mac address-table interface Gi0/1lists everything learned on one port.show mac address-table vlan 10lists one VLAN.
A Linux bridge
bridge fdb show br br0Each line has the form shown below. The exact output varies by kernel and iproute2 version, so this sample is illustrative.
00:11:22:33:44:55 dev eth1 master br0
00:11:22:33:44:66 dev eth2 master br0
33:33:00:00:00:01 dev eth1 self permanent- The first field is the MAC address.
devnames the port where the address was learned.permanentmarks a static entry. Entries without it are dynamic and can age out.master br0says the entry belongs to the bridgebr0.
The bridge fdb show command also takes dev eth1 to limit output to one port, and bridge fdb show br br0 | grep -i 00:11:22 finds a single host.
Comparing the two
| Concept | Cisco IOS-style | Linux bridge |
|---|---|---|
| Show the table | `show mac address-table` | `bridge fdb show br br0` |
| Port column | `Ports` | `dev` |
| Static entry | `STATIC` | `permanent` |
| VLAN | `Vlan` column | `vlan` field when VLAN filtering is on |
Using the table to troubleshoot
A table read tells you what the switch will do with a frame.
- Find where a host is. Look up its MAC address. The port shown is where the switch believes the host sits.
- Explain flooding. If the destination is missing from the table, the switch floods frames to it. A host that never sends traffic, or whose entry aged out, causes this.
- Spot a move or flapping. Run the lookup twice. If the port changes between runs, two ports are claiming the same address. This points to a loop or a duplicate MAC address.
- Check an uplink. Many addresses on one port usually means another switch is behind it.
Exercise
On a Linux bridge, bridge fdb show br br0 lists 00:11:22:33:44:77 dev eth3 master br0, but the host with that address was moved to the cable on eth2 an hour ago and has been sending traffic. What should you expect to see if you run the command again, and why?
Show answer
The entry should now show dev eth2. When the host sends a frame on eth2, the bridge learns the source address on that port and overwrites the old port, so the entry is updated. If the entry still shows eth3, either the host has not sent any traffic, or the entry is permanent and does not follow the host.