When a frame arrives at a switch interface, the destination hardware address
is compared to the forward/filter MAC database. If the destination hardware
address is known and listed in the database, the frame is only sent out the
correct exit interface. The switch does not transmit the frame out any interface
except for the destination interface. This preserves bandwidth on the
other network segments and is called
frame filtering
.
If the destination hardware address is not listed in the MAC database,
then the frame is broadcasted out all active interfaces except the interface the
frame was received on. If a device answers the broadcast, the MAC database
is updated with the device location (interface).

Forward/Filter Decisions

When a frame arrives at a switch interface, the destination hardware address
is compared to the forward/filter MAC database. If the destination hardware address is known and listed in the database, the frame is only sent out the correct exit interface. The switch does not transmit the frame out any interface except for the destination interface. This preserves bandwidth on the
other network segments and is called frame filtering.

If the destination hardware address is not listed in the MAC database,then the frame is broadcasted out all active interfaces except the interface theframe was received on. If a device answers the broadcast, the MAC databas is updated with the device location (interface).

Address Learning

When a switch is powered on, the MAC filtering table is empty. When a
device transmits and an interface receives a frame, the switch places the
source address in the MAC filtering table, remembering what interface the
device is located on. The switch has no choice but to flood the network with
this frame because it has no idea where the destination device is located.
If a device answers and sends a frame back, then the switch will take the
source address from that frame and place the MAC address in the database,
associating this address with the interface that received the frame.

switch now has two MAC addresses in the filtering table, the devices can
make a point-to-point connection, and the frames will only be forwarded
between the two devices. This is what makes layer-2 switches better than
hubs. In a hub network, all frames are forwarded out all ports every time.

Bridging versus LAN Switching

Layer-2 switches are really just bridges with more ports. However, there are
some important differences you should be aware of:

Bridges are software based, while switches are hardware based
because they use an ASICs chip to help make filtering decisions.

Bridges can only have one spanning-tree instance per bridge, while
switches can have many. (We cover spanning tree later in this chapter.)

Bridges can only have up to 16 ports, whereas a switch can have
hundreds.

There are three distinct functions of layer-2 switching:
Address learning
Layer-2 switches and bridges remember the source
hardware address of each frame received on an interface and enter this
information into a MAC database.
Forward/filter decisions
When a frame is received on an interface, the
switch looks at the destination hardware address and finds the exit interface
in the MAC database.
Loop avoidance
If multiple connections between switches are created
for redundancy, network loops can occur. The Spanning-Tree Protocol
(STP) is used to stop network loops and allow redundancy.