• Layer 2 forwarding: At the data link layer, packets are forwarded based on the destination MAC address. During Layer 2 forwarding, the header of packets is not modified.

  • FDB table: Each Layer 2 switch maintains a forwarding information table (FDB). The forwarding entries contain the following information:

    • MAC: indicates the MAC address of the device
    • Port: indicates the port on the switch to which the device is connected.
  • MAC address learning: When switches move together, the internally maintained forwarding information table (FDB table) is empty. After receiving a packet, the FDB table is updated according to the source MAC address and receiving port of the packet.

  • Aging of FDB entries: Each bridge maintains an FDB table with many entries. To prevent unused or invalid entries from occupying the memory, you need to periodically clear these entries. We call this aging of FDB entries.

conclusion

Layer 2 switches learn MAC addresses by themselves to maintain a forwarding information table. After receiving a packet, the MAC address of the packet is used to search for the corresponding outbound port. The packet is directly forwarded from the outbound port. If the packet is broadcast, the packet is broadcast in the entire Layer 2 switch and a copy is sent from each other port on the Layer 2 switch. If no corresponding entry is found after searching for the forwarding information table, the layer 2 switch floods, that is, sends a copy from each port on the Layer 2 switch. In this way, devices connected to each port can receive a packet. If the packet is destined for the local device, the corresponding device processes the packet. Other devices discard packets that are not destined for the local host.