Switches are layer-2 devices and forward incoming packets based on the
MAC layer destination address. Furthermore, switches are self-learning and
build their switching table automatically and dynamically adapt to network
When a packet arrives on one of the interfaces, the switch behaves as follows:
The switch stores the source MAC address of the packet and the interface
from which the packet arrived in the switching table (backward
learning) and it adds an aging time.
Afterwards it looks for the packet's destination MAC address in the
switching table and behaves as follows
Flooding: if the address is not found, a copy
of the packet is sent over all the other interfaces
Filtering: if the destination address is on
the same interface as the source, nothing is done by the switch
Forwarding: the switch forwards the packet to
the interface found in the switching table.
The switch deletes an entry in the switching table, if no packets are received
from this source after some time period (aging time). Thus it dynamically
adapts to changes in the network.
Try the application by yourself. You are able to delete the switching tables
and see how the switches behave with filled or empty tables!