MAC addresses and frames
How does data find one machine among many on the same network?
Every network card has a 48-bit MAC address. Ethernet sends data in frames, and each frame begins with the destination MAC.
Twenty machines share one office network. How does data reach just one of them? Every network card is made with an address of its own, the MAC address: forty-eight bits, written as six pairs of hex digits. The first half is a block given to the maker; the second half the maker sets, different for every card. Data travels in frames. A frame puts a header in front of the data: the MAC it is going to, the MAC it came from, and a type that says what is inside. A check value follows at the end. The destination comes first, and it is the only field a switch needs.
MAC address learning
A switch learns where each address lives from the frames it sees
A switch records each frame’s source MAC against its port, forwards known destinations, and floods unknown ones.
A new switch knows nothing. Watch it learn from four frames. A sends to B. The switch notes that A lives on port one. It has never heard of B, so it floods the frame out of every other port. B replies to A. Now the switch learns B is on port two, and since it knows where A is, it sends the reply out of port one only. C sends to A: C is learned on port three, and the frame goes straight to port one. A sends to D, whom the switch has not heard from, so that one is flooded. After four frames, three hosts are known. Nobody configured anything.
MAC address learning · Going deeper · 1 of 2
Forward, filter or flood
Known destinations are forwarded or filtered. Unknown unicast, broadcast and multicast are flooded out of every other port in the VLAN.
MAC address learning · Going deeper · 2 of 2
Cut-through starts after the address; store-and-forward checks the whole frame
Store-and-forward waits 12.1 µs for a full frame at 1 Gbps and drops bad ones; cut-through starts in about 112 ns.
A switch can start sending a frame on before it has finished arriving. A full-size frame takes about twelve microseconds to arrive at one gigabit. A store-and-forward switch waits for all of it, checks the checksum at the end, and drops it if it is corrupt. A fragment-free switch waits only for the first sixty-four bytes, where collision damage would show. A cut-through switch starts as soon as it has read the destination address, about a tenth of a microsecond in, and passes on whatever follows, good or bad.
Duplex and speed
A duplex mismatch keeps the link up and quietly ruins it
With one end at full and the other at half duplex, one side logs late collisions and the other CRC errors and runts.
Links can send in both directions at once, full duplex, or take turns, half duplex. A mismatch is one of the classic faults. Port A is fixed at full duplex and sends whenever it has data. Port B fell back to half duplex. When A’s frame arrives while B is sending, B thinks it is a collision, stops, and retries. A, meanwhile, receives B’s frames cut short and counts them as errors. The link stays up and pings work, but under load it crawls.
Duplex and speed · Going deeper
Reading interface counters and states
CRC errors and runts point to cabling or a mismatch, giants to an MTU problem, and late collisions to half duplex. err-disabled means the switch shut the port.
CDP and LLDP
Every device tells its neighbours who it is and which port they share
CDP (Cisco) and LLDP (IEEE 802.1AB) list each neighbour, its platform and the ports at both ends of the link.
How do you know the network diagram is true? Ask the devices. SW1 has a router, an access point and a phone plugged in. show cdp neighbors lists each one: its name, the local port, the remote port and the platform. Port twenty-four goes to R1’s gigabit zero zero one, as the diagram says. LLDP does the same job as an open standard, and phones use its MED extension to learn their voice VLAN and power.
Lesson complete
You finished “Ethernet and switching”
Nicely done.