New Network Card, Network Forgets You: MAC Addresses | OSI Layer 2
The crate and the switch-depot: plaques, ribbons and who sorts by MAC.
She can print. She can open files on the server down the hall. But no website loads, and the other office might as well be on the moon. Layer 1 is fine, Layer 2 is fine — so what gets data off the street and across the city? In this episode Professor Flows explains the Network layer using Byte City: the lawn sign is the IP address, the intersection is a router, the road atlas is its routing table, and the mail bag is the packet.
A user can print. She can open files on the server down the hall. But no website loads, and the other office might as well be on the moon.
The link light is green, so Layer 1 is fine. She can reach her neighbours, so Layer 2 is fine. Everything on her street works. Nothing beyond it does. So the problem is whatever gets data off the street and across the city. That is Layer 3 of the OSI model: the Network layer.

On a single street, houses are known by the brass plaque bolted to the wall: the MAC address. That can't work across a city, because a plaque tells you who a house is, not where it is.
So every house also has a lawn sign out front. That is its IP address: four numbers, each from 0 to 255.
An IP address is really two addresses in one. The first part names the street. The last part names the house on that street. The street sign on the corner tells you where the split is. A sign reading 192.168.1.0/24 means the first 24 bits, here the first three numbers, are the street. Whatever is left is the house. The street is the network, or subnet. Subnetting has lessons of its own; this is all you need for now.
One more difference. The plaque is stamped at the factory. The lawn sign is paint. Move the house to another street and you repaint the sign: new street, new number. That is why engineers call the MAC address a physical address and the IP address a logical one.

Before a house sends anything, it asks one question: is this going to my street, or somewhere else?
It checks the street part of the destination against its own. If they match, the neighbour is local. The house rings the doorbells to learn the neighbour's plaque (that is ARP) and crates the data straight to that house.
If they don't match, the house doesn't even try. It crates the data to the gate at the end of the street. In a real network, that is the default gateway.
Remember what is inside that crate: the mail bag, with the real destination's lawn-sign number still on it. The crate says "to the gate". The bag says where the data is really going.

The default gateway MUST be on the same network as the house. Same street. No exceptions.
Here is why. The only way to hand over a crate is to ring the doorbells for a plaque, and doorbells only ring on your own street. A house at 192.168.1.10 can reach a gate at 192.168.1.1. It can never reach a gate at 192.168.2.1. A gateway on a different network is a gateway that doesn't exist.

At the gate, and at every intersection after it, the same thing happens. The crate is opened and thrown away. The mail bag comes out. And someone looks up the bag's destination in a road atlas.
The intersection is a router. The atlas is its routing table. The atlas is surprisingly small, because it doesn't list houses. It lists streets. For each street it says one thing: which exit to take, and who to hand the bag to next.
| Street (destination) | Send the bag... |
|---|---|
| 192.168.1.0/24 | this street: exit A |
| 192.168.2.0/24 | this street: exit B |
| 10.0.5.0/24 | to the next intersection, 192.168.2.2 |
| 10.0.0.0/8 | the whole 10 district: to 192.168.2.9 |
| everything else (0.0.0.0/0) | that way: 192.168.2.254 |
If two rows both match, the more specific one wins. A bag for 10.0.5.20 matches the row for the exact street and the row for the whole district, and the exact street wins. Engineers call that longest prefix match.
At the bottom is the most important row of all: everything else goes that way. That is the default route. No router knows the whole city. Each one knows its own streets, and which neighbour to ask about the rest.
The rows get there in one of two ways. Somebody writes them by hand, which is static routing. Or the intersections tell each other what they can reach, which is dynamic routing.
Then the bag goes into a new crate with new plaques and leaves by the chosen exit.

The mail bag is a packet, and its tag carries three things worth knowing. Where it came from. Where it is going. And an expiry stamp: a number, usually starting at 64 or 128.
Every intersection that handles the bag knocks one off the stamp. If the stamp ever reaches zero, the bag is destroyed on the spot, and a short note goes back to the sender saying so.
Why build in a self-destruct? Because atlases can be wrong. If two intersections each think the other one is the way, a bag would circle between them forever, and so would every bag after it. That is a routing loop. The expiry stamp guarantees that a lost bag eventually dies instead of clogging the city.
The stamp's real name is time to live: TTL. The notes routers send back are ICMP, the same system that ping uses.
The city ran out of four-number lawn signs. There are only about four billion of them. The replacement is IP version 6: much longer addresses, written in hexadecimal, enough for every device we will ever build. Same idea, same layer, bigger numbers.

On Windows, ipconfig shows all three pieces: your lawn sign, the subnet mask (the street sign's split, written the long way) and your gate.
Back to our user. Her gate is set to 192.168.1.11. The real gate is 192.168.1.1. Somebody made a typo. Everything on her own street never needed the gate, so it all worked. Everything else was being crated to a house that doesn't exist. Fix one number, and the whole city opens up.
To watch Layer 3 work, run tracert. It sends bags with an expiry stamp of 1, then 2, then 3, so each intersection in turn destroys one and sends a note back. Those notes are the list you see: every router on the path, in order.
One for the Network+ exam. A host at 192.168.1.10/24 sends a packet to 10.0.5.20. Which destination MAC address is on the frame as it leaves the host? The default gateway's. The far house's MAC address never appears on her street. The bag carries the far address. The crate only ever carries the next stop.
The logical address of a host: four numbers from 0 to 255 in IPv4. Part of it names the network and the rest names the host on that network.
The first 24 bits, which is the first three numbers, name the network. The last number names the host. Written as a subnet mask, /24 is 255.255.255.0.
The router a host sends to when the destination is not on its own network. It must have an address on the same network as the host, or the host can never reach it.
Time to live: a number in every packet that each router lowers by one. At zero the packet is destroyed and an ICMP message goes back to the sender, which stops packets circling forever in a routing loop.
Local traffic never uses the default gateway, so it keeps working when the gateway setting is wrong. Run `ipconfig` and check that the default gateway is the router's real address.
Five questions on this lesson. Pick an answer to see why.
Previous
The crate and the switch-depot: plaques, ribbons and who sorts by MAC.
Next
Numbered doors, the truck that calls ahead and the bullhorn that doesn't.
Related
One click, seven floors down, across the city, and back. Every layer in one trip.
Related
The road: copper, glass and radio, and what a dark link light means.
Exam objectives: CompTIA Network+ N10-009: 1.1 (OSI model), 1.4 (ICMP), 1.7 (IPv4 addressing, CIDR), 2.1 (routing: static, dynamic, default route), 5.5 (ipconfig, ping, tracert).
Byte City is not affiliated with or endorsed by CompTIA.