Lessons · Network switches · what a switch does
What a switch is actually doing
A switch learns which device is on which port, then sends each frame only to the port that device is on.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
Every office network, every plant floor, every rack you will ever stand in front of is switches. Knowing what the box is doing is the difference between reading a fault and guessing at one.
How to think about it
Ask two questions about any frame: what is the destination address, and has this switch seen that address before? Those two answers decide everything it does next.
Worked example
enableThe switch starts you in the read-only room. enable moves you to the one that can see everything; the prompt changes from > to #.
show mac address-tableThe list of addresses it has learned, with the port each one was heard on. On a switch nobody has plugged anything into, it is empty, and that is the honest starting point.
show interfaces statusEight ports, what is connected, and which VLAN each one is in. This and the address table are the two screens you will read most often.
Your turn
Move from the read-only prompt to the one that can see everything.
Console into a switch
The trap
Thinking a switch reads IP addresses. It does not: it reads MAC addresses, which is why a switch can move traffic between two machines that have no IP configuration at all.