Skip to content

Try “polymorphism”, “TCP handshake” or “git rebase”.

    Computer Basics / Networking 1: Addresses and Routing

    Packets

    Each envelope is a packet: a small chunk of data plus a header (the writing on the envelope —

    Chapter 1 of 115 min read

    Start With the Problem#

    StudyBuddy on your laptop in Bangalore wants to ask StudyBuddy's server — a computer in a data centre in Mumbai — "give me Priya's notes."

    Between the two machines there is your Wi-Fi box, your internet provider's equipment, fibre-optic cables across India, and the data centre's own equipment. Billions of other computers are connected to the same internet at the same time.

    • How does your message know which of those billions of computers to go to?

    • Nobody has a map of the whole internet. How does each box along the way know which direction to send it?

    • Your message and a Netflix video are travelling over the same cables. How do they not get mixed up?

    • If one cable breaks halfway, how does anything still arrive?

    The answers are four ideas: packets, layers, addresses and routing. That's this file.

    The Plain Picture#

    You're sending a 500-page book to a friend in another city, but the post office only accepts envelopes of up to 5 pages. So you:

    1. cut the book into 100 envelopes of 5 pages,

    2. write on each: to address, from address, and "part 37 of 100",

    3. post them all.

    The envelopes may travel on different trucks and arrive in any order. Your friend uses the part numbers to put the book back together, and asks you to resend any missing parts.

    Also notice: the trucks and roads are shared with everyone else's mail. Nobody reserves a whole road for your book.

    The Real Name#

    • Each envelope is a packet: a small chunk of data plus a header (the writing on the envelope — addresses and other control information). The data part is called the payload.

    • Cutting data into packets and sending each independently over shared links is packet switching. It's how the internet works.

    • The opposite, reserving a dedicated line for the whole conversation, is circuit switching — how old landline telephones worked.

    Under the Hood#

    Why packets won:

    Circuit switching (old phones)Packet switching (internet)
    Line usewhole line reserved, even during silenceshared; idle time used by others
    If a link breakscall dropspackets take another route
    Costexpensive, wastefulcheap, efficient
    Downside—packets can be delayed, lost, duplicated or reordered

    That last row is important. The internet makes no promises: packets can get lost, arrive twice or arrive out of order. This is called best-effort delivery. Making it reliable is the job of TCP, in the next file.

    How big is a packet? On typical Ethernet and Wi-Fi, a packet can be at most 1,500 bytes (the MTU, Maximum Transmission Unit). Our StudyBuddy note from file 01 (7 bytes) fits easily. A 5 MB PDF of notes becomes roughly 3,500 packets.

    Check yourself

    4 questions
    1

    What are the two parts of a packet?

    Show answer

    The header (addresses and control info) and the payload (the data).

    2

    Why is packet switching cheaper than circuit switching?

    Show answer

    Links are shared — idle capacity is used by other people's packets instead of being reserved.

    3

    What does "best-effort delivery" mean?

    Show answer

    The network tries to deliver packets but guarantees nothing: they can be lost, duplicated, delayed or reordered.

    4

    About how many packets does a 3 MB file need with a 1,500-byte MTU?

    Show answer

    About 3,000,000 ÷ 1,500 = 2,000 (a bit more in practice, because headers take some room in each).