← All lessons
How networks work · Lesson 3 of 7

Ethernet and switches

Ethernet is the usual way wired devices connect on a LAN, over the familiar cables with clip-in plugs. It's a layer 2 protocol: it gets data from one device to another on the same network.

Every network card, wired or Wi-Fi, has a MAC address set when it's made: 48 bits, written as six bytes in hex, like 3C:22:FB:7A:10:9E. The first three bytes say who made the card. A MAC address only matters on the local network; it isn't used to find things across the internet.

Ethernet sends data in frames. A frame starts with the destination MAC address and the source MAC address, then the data (often an IP packet), then a check value so the receiver can spot a frame that was damaged on the way.

Devices on a LAN plug into a switch. A switch learns: every time a frame arrives, it notes the source MAC address and which port it came in on. When a frame is going to a MAC it knows, it sends it out of that one port only. When it doesn't know yet, it floods the frame out of every other port, and learns from the reply. Older hubs simply copied every frame to every port, which was slower and let everyone see everything.

One address is special: FF:FF:FF:FF:FF:FF, the broadcast address. A frame sent to it goes to every device on the LAN. Devices use broadcasts to ask questions when they don't know who to ask, like "who has this IP address?"

Practice

How many bits long is a MAC address?

More info

Quick reference

EthernetWired LAN protocol (layer 2).
MAC address48-bit hardware address: 3C:22:FB:7A:10:9E.
FrameDestination MAC, source MAC, data, check value.
SwitchLearns MAC → port and sends each frame only where it's going.
BroadcastFF:FF:FF:FF:FF:FF: every device on the LAN.

The other networking courses