- [Narrator] Switching operates at layer two,
the data link layer.
Here, the protocol data unit,
which is a single unit of information transmitted,
is called a frame.
When frames are sent, the sending device
puts its address as the sender
and adds the destination address to the destination field
inside of the frame's header.
The header is a section of the PDU that contains information
about how the frame should be transmitted.
Ethernet addresses are known as
Media Access Control addresses.
MACs are six-byte long values represented
as a 12-digit hex number.
MACs are sometimes also called a burned-in address,
as they are unique and assigned from the manufacturer.
In addition to unique MAC addresses,
there are also a few group addresses
which are designed to send traffic
to multiple hosts at once.
Frames destined to the broadcast address, which is all Fs,
will be delivered to all devices on the LAN.
In essence, it should be delivered to all hosts
on this subnet.
Frames destined to the multicast address
will be sent to a subset of devices
that volunteer to receive the traffic.
Ethernet contains a Frame Check Sequence field
in the frame trailer.
A complex formula is applied to the information being sent
and the value is stored in the FCS field.
If a switch checks the FCS of a frame
and it's found not to match,
then the frame is simply discarded with no further action.
This is to ensure the packet isn't corrupted in transit.
When a switch first powers up, it has no knowledge
about what clients are connected where in the network.
The switch will only learn about the network
as hosts send frames.
The switch learning process is as follows.
First, host A in this diagram sends a frame
destined for host B.
The switch then references a special table
known as the MAC address table,
often referred to as address table or simply MAC table.
This table maintains a list of all known MAC addresses
and what ports they are available through.
Since the MAC table is currently empty,
the switch will employ a technique known as flooding.
Flooding a frame means the switch will send it out
every port save for the one it entered from.
In this example, host B receives the frame
and then responds back to the original sender.
When host B's frame enters the switch
the address of host B is added to the MAC address table
for future forwarding.
Since host A's address currently resides in a table,
the frame is then forwarded directly out of the port
that connects to host A.
The same process repeats if multiple switches
are connected together.
Note that if a frame is flooded
in a multi-switch environment
and the destination is unknown on all of the switches,
then the frame is flooded across all switches.
Each entry in the MAC table consumes memory on the switch,
thus each switch has a maximum number of entries
it can store in its table.
This maximum varies from switch to switch.
To combat the table from filling up,
switches have the concept of MAC address aging.
The aging time,
which usually defaults to around 300 seconds,
is how long an entry will remain in the table
if no further frame sourced from this host enter the switch.
If a host ages out, then the standard flooding
and learning process repeats for it.
Understanding the MAC learning process can save you
as you chase down hosts during troubleshooting.