How TCP/IP Powers the Internet
Transcript
You tap a link. In less time than a blink, a request leaves your phone, races through cables under the street, maybe dives into the ocean, reaches a computer on another continent, and the page comes back. Along the way it passes through a dozen machines that have never heard of you, owned by companies you have never heard of. And yet it arrives, almost every single time. How? Not by magic, and not by one big computer in charge. The internet works because every machine on it follows the same small set of rules, called protocols.
The most important pair of rules is called TCP/IP. TCP and IP are the grammar of the internet. Every message, video call, game and payment you make speaks it. In this video we will follow one request from your screen to a server and back, and learn every idea on the way: packets, layers, IP addresses, routers, ports, the TCP handshake, DNS, HTTPS, and more.
No background needed. Each idea comes with a simple picture, an everyday analogy, and at least one true story so strange it is hard to forget. Our story starts in 1969, in a university lab in Los Angeles. On the evening of October 29, a student named Charley Kline tried to log in to a computer at the Stanford Research Institute, about five hundred kilometres away, over a brand new network called ARPANET.
He typed L. It arrived. He typed O. It arrived. He typed G, and the system crashed. So the first message ever sent over the network that became the internet was simply: lo. As in, lo and behold. The login worked about an hour later. ARPANET grew, but soon there were many different networks that could not talk to each other. In 1974, Vint Cerf and Bob Kahn published a design to connect networks of networks. That design became TCP/IP.
On January 1, 1983, ARPANET switched over to TCP/IP in a single day, a moment engineers still call flag day. Many people consider that the birthday of the internet. And the World Wide Web came later still. Tim Berners-Lee proposed it in 1989 at CERN, as one more service running on top of the internet. The internet is the roads. The web is just one kind of traffic on them.
The first big idea of the internet is the packet. Old telephone networks used circuits. When you called someone, a dedicated line was reserved for you from end to end, for the whole call, even during the silences. Like booking an entire road just for your car. The internet does something cleverer. It chops every message into small pieces called packets, often around fifteen hundred bytes each, and sends each one separately.
Think of mailing a whole book by cutting it into numbered postcards. Each postcard carries the address, a return address, and its page number. They can travel by different routes and arrive in any order. At the other end, the page numbers let you rebuild the book. This is called packet switching. Because no line is reserved, millions of people can share the same cables at the same time, each sending postcards in the gaps between everyone else's.
And if one route is broken, packets simply go another way. The network bends around damage instead of breaking. That idea of resilience was one of the main goals of the early research. To send a packet, many different jobs must be done. So networking is organised in layers, each with one job, each relying on the layer below it.
Think of sending a gift. You write a letter and put it in the gift. You put the gift in a box and write the receiver's name and flat number. The courier adds a city and pin code label. And a truck, a plane or a bike actually moves it. TCP/IP has four layers that work the same way. The application layer is your message: a web page, an email, a chat. The transport layer, TCP or UDP, makes sure it reaches the right program, complete and in order.
The internet layer, IP, carries the address that gets the packet across the world. And the link layer moves it over one physical hop: a Wi-Fi signal, an Ethernet cable, or a fibre. Each layer wraps the data from the layer above inside its own header, like Russian dolls. This is called encapsulation. At the other end, the layers unwrap it in reverse order. You may also meet the OSI model, which has seven layers instead of four. It splits the same jobs more finely, and engineers use its numbers in everyday talk. When someone says a layer seven problem, they mean the application.
Let us start at the bottom. In the end, every packet is just a stream of ones and zeros. In a copper cable they are pulses of electricity. In a fibre optic cable they are flashes of light, switching on and off billions of times a second. Over Wi-Fi and mobile networks they ride on radio waves. Inside your home or office, the main link standard is Ethernet. Every network card has a MAC address, a hardware name of forty-eight bits, written as six pairs of letters and numbers. A switch uses these names to deliver frames to the right device on the local network.
Across the oceans, the internet runs on undersea fibre cables, laid on the sea floor. They carry nearly all the data that travels between continents. Satellites carry only a small share. And here is the strange part. The internet does not care what carries the bits. In 1990, an April Fools' document described IP over Avian Carriers: sending internet packets by carrier pigeon.
In 2001, a Linux user group in Bergen, Norway actually did it. They sent nine pings, each tied to a pigeon. Four came back, after about fifty minutes to an hour and three quarters. Slow, lossy, and completely valid internet. Now the internet layer. Every device that talks on the internet needs an address, just like every house needs one for the post. This is the IP address.
The classic version, IPv4, is a number of thirty-two bits. We write it as four numbers from zero to two hundred and fifty-five, separated by dots, like 142.250.183.14. Thirty-two bits allow about 4.3 billion addresses. That sounded endless in 1981. Today there are far more phones, laptops, TVs and cameras than that. The central pool of new IPv4 addresses ran out in 2011.
So we cheat, with a trick called NAT, network address translation. Your home router has one public address on the internet. Every device inside gets a private address, like 192.168.1.5, which is reused in millions of homes. Think of an apartment building with one street address. Letters arrive at the building, and the watchman at the gate keeps a notebook of which flat asked for what, so each reply goes to the right door.
Your mobile operator often does the same thing on a giant scale, so thousands of phones may share one public address at once. IP addresses are not handed out one by one. They come in blocks, and each address has two parts: a network part and a host part. It is like a postal address with a pin code and a house number. The pin code tells the postal system which area to send it to. The house number picks the house inside that area.
A subnet mask, or a short slash number, tells you where the split is. In 192.168.1.0 slash 24, the first twenty-four bits are the network. The last eight bits pick the device. Eight bits give two hundred and fifty-six addresses. The first one names the network itself, the last one is for broadcasting to everyone, so two hundred and fifty-four devices can join. Slash 24 is the same as the mask 255.255.255.0.
Change the slash number and the block changes size. Slash 16 has over sixty-five thousand addresses. Slash 30 has just four. This flexible system is called CIDR, and it lets organisations get exactly the size of block they need. When your computer wants to send a packet, it first checks: is this address in my own subnet? If yes, it delivers it directly. If not, it hands the packet to the default gateway, your router, the door to the rest of the world.
The real fix for running out of addresses is IPv6. IPv6 addresses are one hundred and twenty-eight bits long, written as eight groups of hexadecimal digits separated by colons. Long runs of zeros can be squeezed into a double colon. One hundred and twenty-eight bits gives about 340 undecillion addresses: a three followed by thirty-eight zeros.
To feel how big that is: IPv4 has fewer addresses than there are people on Earth. IPv6 has enough to give trillions of addresses to every grain of sand on every beach, and still not make a dent. With so many addresses, every device can have its own public address again, without NAT tricks. IPv6 also simplified the packet header to make routers faster.
The switch is slow, because the two versions cannot talk to each other directly. So for now the internet runs both side by side. A large and growing share of traffic, including on many Indian mobile networks, already uses IPv6. So a packet has an address. How does it find its way across the world? Through routers.
A router is like a sorting office at a busy junction. It does not know the whole route. It looks at the destination address and decides only one thing: which road to send the packet down next. This is called hop by hop forwarding. Each router keeps a routing table, a list of address blocks and the next hop for each. It picks the most specific match, the longest prefix. Anything it does not recognise goes to its default route.
What stops a packet from going round in circles forever? Every IP packet carries a counter called time to live, or TTL. Each router subtracts one. When it reaches zero, the packet is thrown away and the sender gets a short error note. A tool called traceroute uses that trick cleverly. It sends packets with a TTL of one, then two, then three. Each router that drops one reveals itself, so you can see every hop between you and a website.
Try it yourself. On Windows, type tracert, followed by a website name. You will often see ten to twenty hops, and sometimes the names of cities your packets pass through. Inside one company, routers share maps with each other. But the internet is made of tens of thousands of separate networks run by different organisations, called autonomous systems.
Between them runs one protocol: BGP, the Border Gateway Protocol. Each network announces to its neighbours: these address blocks are reachable through me. The neighbours pass it on, and on, until the whole internet knows. BGP is basically gossip between giants. And for a long time, networks largely believed what their neighbours told them. In February 2008, Pakistan Telecom was ordered to block YouTube inside the country. It announced a more specific route for YouTube's addresses, meant to stay at home. The announcement leaked to the wider internet, and much of the world started sending YouTube traffic to Pakistan. YouTube was unreachable for many people for about two hours.
In October 2021, Facebook did it to itself. A maintenance command accidentally disconnected its backbone, and its BGP routes were withdrawn. Facebook, Instagram and WhatsApp vanished from the internet for about six hours. Reports said even some staff badges stopped opening doors. Today, networks increasingly sign their route announcements with a system called RPKI, so that false claims can be spotted and rejected.
The IP address gets the packet to the right computer. But your computer runs many programs at once: a browser, a chat app, a game. Which one should get it? That is the job of ports. If the IP address is the building, the port number is the flat number. Ports run from zero to 65,535. Some are famous. Port 80 is for ordinary web traffic. 443 is for secure HTTPS. 22 is for SSH, 25 for sending email, and 53 for DNS. Your side of the conversation gets a random temporary port.
The transport layer offers two very different services. UDP is like sending a postcard. You write it and drop it in the box. Fast and simple, but nobody checks it arrived, and nobody puts the postcards back in order. TCP is like registered post with a tracking number. Every piece is counted, delivery is confirmed, lost pieces are sent again, and everything is handed over in the right order.
Web pages, email and file downloads use TCP, because every byte must be perfect. Video calls, online games and live streams often prefer UDP, because a late packet is useless. Better a tiny glitch than a frozen face. Before TCP sends any data, the two sides shake hands. Three messages, called the three-way handshake.
Your computer sends SYN: hello, I would like to talk, and I will start counting from this number. The server replies SYN-ACK: hello, I heard you, and I will count from this number. You reply ACK: great, I heard you too. There is an old engineers' joke: Hi, I'd like to hear a TCP joke. Hello, would you like to hear a TCP joke? Yes, I'd like to hear a TCP joke. And then the joke finally begins.
After the handshake, every byte gets a sequence number, like the page numbers on our postcards. The receiver sends back acknowledgements: I have everything up to here. If an acknowledgement does not arrive in time, the sender assumes the packet was lost and sends it again. Duplicates are thrown away, gaps are filled, and the program receives a perfect, ordered stream. When the conversation is over, each side sends FIN to say goodbye, and the other confirms. Every web page you have ever loaded began and ended with this polite little ceremony.
TCP has one more job, and it saved the internet. It controls how fast to send. First, flow control. The receiver tells the sender how much room it has left, called the window. A slow phone cannot be flooded by a fast server. Second, congestion control, which protects the network itself. In October 1986, the early internet suffered a congestion collapse. Between two labs in Berkeley, about four hundred metres apart, speed fell from 32 kilobits per second to 40 bits per second, a thousand times slower.
Everyone was resending lost packets as fast as possible, which caused more losses, which caused more resending. A traffic jam where every driver keeps honking and pushing forward. Van Jacobson and colleagues fixed it. TCP now starts gently, with slow start, and grows its speed step by step. The moment it detects loss, it backs off sharply, then climbs again slowly. Every connection politely shares the road.
That sawtooth of speeding up and backing off is happening in every download you make, on billions of connections at once. Modern versions are smarter, but the spirit is the same. So far, computers have been using numbers. But you type names, like youtube.com. Something must turn names into IP addresses. That is DNS, the Domain Name System.
DNS is the internet's phone book, but no single book could hold the whole world. So it is split into a tree, read from right to left: the root, then top-level domains like dot com or dot in, then each organisation's own servers. When you look up a name, your device asks a resolver, usually run by your internet provider. If the resolver does not already know, it asks a root server: where can I find dot com? Then it asks a dot com server: where can I find youtube dot com? Then it asks YouTube's own name server for the final address.
There are thirteen root server identities, named with the letters A to M. But each one is actually copied across hundreds of sites around the world, more than a thousand in total, all sharing the same addresses, so your question goes to the nearest one. Answers are remembered, or cached, for a while, so most lookups take only a few milliseconds. If the cache holds a wrong answer, people can be sent to the wrong place, which is why DNS security matters.
In October 2016, a botnet called Mirai, built from hacked home cameras and video recorders, flooded the DNS company Dyn with junk traffic. For hours, many people could not reach Twitter, Netflix, Reddit and GitHub, even though those sites were running fine. Nobody could look up their addresses. How does your phone even get an IP address when you join a Wi-Fi network? Nobody types it in. A protocol called DHCP does it automatically.
It takes four messages, easy to remember as DORA. Discover: your phone shouts, is there a DHCP server here? Offer: the router replies, you can have this address. Request: your phone says, yes please. Acknowledge: the router confirms. Along with the address, the router hands over the subnet mask, the default gateway, and the DNS servers to use. The address is a lease, not a gift. It expires after a while unless your device renews it.
One more local problem remains. To send a frame to the router on the same network, your phone needs the router's MAC address, but it only knows its IP address. So it uses ARP, the Address Resolution Protocol. It shouts to everyone on the local network: who has 192.168.1.1? Tell me your MAC address. Only the router answers. Like a teacher calling a roll number in class, and only one student stands up.
This trusting shout is also a weakness. On a shared network, a device can lie and claim to be the router, which is one reason public Wi-Fi needs encryption on top. Now the application layer, where you actually see things. The web speaks HTTP, the HyperText Transfer Protocol. HTTP is a simple conversation of requests and responses. Your browser sends a request: GET, slash index dot html, please. The server sends back a status code, some headers, and the page itself.
The status codes tell the story. 200 means OK. 301 means it moved, look over there. 404 means not found. 500 means the server itself broke. Codes in the four hundreds are your mistake; five hundreds are theirs. And then there is code 418: I'm a teapot. It comes from a 1998 April Fools' standard about controlling coffee pots over the internet. A teapot asked to brew coffee should refuse with 418. Some real websites still return it as a joke.
HTTP itself has no memory between requests. So websites hand your browser small notes called cookies, which it sends back each time. That is how a site remembers you are logged in, or what is in your cart. HTTP keeps evolving. HTTP/2 sends many files over one connection at once, and HTTP/3 runs over a new protocol called QUIC, built on UDP, which makes connections faster to start and better on shaky mobile networks.
Plain HTTP travels as readable text. Anyone on the path, on a cafe's Wi-Fi for example, could read it or change it. The padlock in your browser means the connection uses HTTPS: HTTP wrapped inside TLS, Transport Layer Security. TLS gives three guarantees. Privacy: nobody in between can read it. Integrity: nobody can change it without being caught. And authenticity: you are really talking to the site you asked for.
Here is the clever part. You and the server have never met, yet you need a shared secret key, and you must agree on it in public, while anyone can listen. Think of mixing paint. You and the server each keep a secret colour, mix it with a public colour, and swap the mixtures in public. Each of you then adds your own secret colour to the other's mixture. You both end up with the same final colour, and a spy who saw only the mixtures cannot work it out. Real TLS does this with mathematics instead of paint.
But how do you know the other side is really your bank, not an impostor? The server shows a certificate, a digital ID card signed by a trusted certificate authority. Your browser already carries a list of authorities it trusts, and checks the signature. Ten years ago, many websites still did not use HTTPS. Free certificate services such as Let's Encrypt helped change that, and today most web pages you visit are encrypted.
HTTP is the star, but the internet runs on a whole supporting cast of protocols. Email uses SMTP to send messages between mail servers, and IMAP to read them from any device. That is why your inbox looks the same on your phone and your laptop. SSH gives engineers a secure remote terminal to control servers far away, and FTP was the old way of moving files. NTP keeps clocks in sync across the world to within milliseconds, which matters for everything from bank transactions to security certificates.
ICMP carries the network's error and test messages. Its most famous tool is ping, which sends an echo request and times the reply. Its creator, Mike Muuss, named it after the sound of sonar on a submarine: send a ping, wait for the echo. Wi-Fi and Bluetooth handle the radio links nearby, and your mobile network handles the radio link to the tower. Above them all, the same IP packets flow unchanged.
That is the beauty of the design. Any application can run over IP, and IP can run over any link: copper, light, radio, or even pigeons. Engineers draw it as an hourglass, with IP at the narrow waist. Now let us put it all together, and follow one click from start to finish. You join the Wi-Fi. DHCP gives your phone an IP address, a subnet mask, a gateway and DNS servers. ARP finds the router's MAC address.
You type a website name. DNS turns the name into an IP address, asking the root, the top-level domain and the site's own name server, unless the answer is already cached. Your browser opens a TCP connection to port 443 with the three-way handshake, then a TLS handshake agrees on secret keys and checks the certificate. It sends an encrypted HTTP GET request. The request is wrapped layer by layer, passes through your home router's NAT, then hops from router to router, following routes that BGP spread across the world, maybe along an undersea cable.
The server unwraps it, builds the page and sends it back as hundreds of packets. TCP puts them in order, TLS decrypts them, and your browser draws the page. All of it, very often, in less than a second. Why does all of this matter to you? Because every job in technology now touches networks: software development, cloud computing, cybersecurity, data, even AI. When something breaks, the person who understands the layers is the one who fixes it.
Start by exploring your own computer. On Windows, ipconfig shows your IP address, mask and gateway. ping tests whether a machine is reachable and how fast. tracert shows the hops. nslookup asks DNS a question directly. Then install Wireshark, a free tool that shows every packet flowing in and out of your computer. Open a website and watch the DNS lookup, the TCP handshake and the TLS handshake happen in front of your eyes.
A good learning order is: the layers and encapsulation first. Then IP addressing and subnetting, with lots of practice. Then routing, then TCP and UDP, then DNS, DHCP and HTTP, and finally security, with TLS and firewalls. Certifications like CCNA follow roughly this path. Remember the pictures: postcards with page numbers, Russian dolls of layers, addresses like pin codes, routers as sorting offices, a handshake before talking, a phone book for names, and a padlock built from mixed paint.
The next time a page loads in a blink, you will know what really happened: a polite conversation between thousands of machines, all following the same small set of rules, agreed by people who have never met. That is the internet.

Ask anything
We've read this whole study set, so questions about it get the best answers.