Course outline · 0% complete

0/30 lessons0%

Course overview →

Hosts, links, and packets

lesson 1-1 · ~11 min · 1/30

Two machines and something in between

A network is any arrangement that lets two machines exchange data. That is the whole definition. Everything else in this course is detail about how to do it reliably, at scale, and without a human in the loop.

Four words carry most of the weight, so define them once and use them all semester:

- Host: any machine that runs applications and sends or receives data. Your laptop is a host. So is a web server, a phone, a printer, and a thermostat. - Link: the physical or wireless path that carries bits between two points. A copper cable, a fiber strand, a Wi-Fi channel, a 5G radio. - Interface: the hardware on a host that attaches it to a link, also called a NIC (network interface card). A host with Wi-Fi and Ethernet has two interfaces, and each one gets its own addresses. - Address: a name for an interface that other machines can aim at. Every layer has its own kind of address, which is why Unit 3 and Unit 4 both spend a lesson on addressing.

Two hosts on one link is the simplest network that exists. It works, and it does not scale, because a link between every pair of hosts would need n(n-1)/2 cables. For 1,000 hosts that is 499,500 cables. So real networks put shared devices in the middle and let traffic take turns.

Switches, routers, and hops

Two device types do the sharing, and the difference between them is the spine of this course.

- A switch connects hosts that are on the same local network. It moves data between interfaces on one link technology, using hardware addresses. Unit 3 is entirely about switches. - A router connects different networks to each other. It decides which neighbor network gets a piece of data next, using IP addresses. Unit 5 is entirely about routers.

Each device the data passes through is a hop. A packet from your laptop to a server in another country typically crosses 10 to 20 hops, and no single hop knows the whole path. Each one only knows the next step, which is what makes the internet able to grow without a central plan.

Some scale vocabulary, because these terms get used loosely in the wild:

TermScopeTypical owner
LAN (local area network)one home, floor, or officeyou or your employer
WAN (wide area network)links between distant sitesa telecom carrier
ISP networka city, region, or countryan internet provider
The internetall of the above, interconnectednobody, by design

The internet is not a network. It is a network of networks that agreed on a common addressing scheme and a common set of rules.

host Ahost Ba network of twohosthostswitchhosthosta network of manyrouterjoins two networks
One link is the smallest network. Real networks put a switch in the middle of each local group, and a router between groups.

Circuits and packets

There are two ways to share one path between many conversations, and networking history is the story of the second one winning.

Circuit switching reserves an end to end path for the whole conversation before any data moves. The old telephone system did this. When you dialed, the exchanges built a dedicated channel from you to the other phone and held it until somebody hung up. The channel was yours even during silence.

Packet switching cuts the data into small independent chunks, called packets, and sends each one into the network on its own. Nothing is reserved. Each hop looks at the packet, picks the next hop, and forwards it. Different packets from the same conversation may take different paths and can arrive out of order.

PropertyCircuit switchingPacket switching
Setup before datarequirednone
Path per chunkfixed for the callchosen hop by hop
Idle capacitywasted, still reservedreused by others
Failure of a hopcall dropsremaining packets reroute
Delaysteady and predictablevaries with load
Cost per bithighlow

Packet switching wins because most traffic is bursty. You load a page, read for 30 seconds, then load another. A reserved circuit would sit idle for those 30 seconds while somebody else needed it. Statistical sharing of one fat link between thousands of bursty conversations carries far more total traffic than handing each one a private slice.

The price is that nothing is guaranteed. Packets can be delayed, reordered, duplicated, or dropped. Unit 7 shows how TCP buys back the guarantees in software, on top of a network that refuses to promise anything.

What a packet actually is

A packet is a small self contained message with two parts:

- A header, a fixed set of fields the network reads, including where the packet is going and where it came from. - A payload, the bytes the application actually wanted to send.

That is it. A packet is a labeled envelope. Every layer you meet in Unit 2 adds its own header to the front, and the receiver peels them off in reverse.

Packets have a size limit called the MTU (maximum transmission unit), which on ordinary Ethernet is 1500 bytes of payload. A 45 KB image does not fit, so the sender chops it into about 31 pieces, each with its own header, and the receiver reassembles them.

Every hop uses store and forward: it receives the whole packet, checks it, then sends it on. That is why each hop adds delay, and why the next lesson measures delay carefully.

A useful habit for the rest of the course: when something is slow or broken, ask which layer's header is wrong or which hop dropped the packet. Networking debugging is almost always a question about one header field or one hop.