What happens next? Using the IP address it looked up, the browser can now attempt to establish a network connection to the target server.
To do so, the browser uses the mechanisms of the Internet Protocol, whose job is to make network connections between computer systems possible. The most important mechanism for this is called routing. Routing is the process of creating a path between a source node on the Internet (your computer) and a target node on the Internet (the computer system with IP address 18.104.22.168, in our example).
The beauty of this routing mechanism is that while your computer needs to know the exact target address it wants to talk to, it doesn’t need to bother how to get its data to this target address.
Again, a metaphor from real life comes to mind.
Let’s assume you want to write a letter to, say, the European Organization for Nuclear Research in Switzerland, also known as CERN. In order to do so, you need a target postal address, and you need to know the next post station where you can mail the letter - and nothing more. The postal system takes care of the rest, and the exact route of the letter and the intermediary post stations involved is neither known to you nor important to you. You can rest assured that the system will route your letter correctly to its destination.
With Internet Protocol routing, it’s the same: Your computer knows the target address, plus it knows the address of its own “next” Internet “station” - this is called the default gateway. When you connect your computer to the Wifi box in your home, the IP address of the Wifi box becomes the default gateway of your computer, and a server system from your Internet provider is in turn the default gateway of your Wifi box.
By delivering data to this default gateway, the data packet starts to travel through the Internet towards its destination through many different systems - or “nodes” - on the Internet, bringing it closer to its target with each step.
Each node simply handing over the data packet to its one “next” node of course isn’t enough, because that would only work if all nodes, including your source and target node, were connected serially on the Internet. But the Internet is a network of many nodes interconnected with each other.
Thus, for routing to be useful, several nodes on the Internet have multiple “next nodes” configured, and depending on the IP address of the target system, will decide to route the data packet in one direction or the other:
NodeJ ^ / / NodeC --> NodeG --> NodeI --> NodeK ^ \ / \ / \ / v Source --> NodeA --> NodeB NodeH /\ / \ / \ v \ NodeD v NodeE --> Target (22.214.171.124)
The above diagram is meant to be a very simplified illustration of the logical structure of a very tiny part of the Internet.
The Source node could be your computer, which has NodeA (probably your DSL router) as its default gateway. When your computer tries to reach the node with IP 126.96.36.199, it has no choice but to hand over data to the only node it knows, NodeA. NodeA also only has one default gateway (probably a system operated by your Internet provider), NodeB.
NodeB, however, has routes to multiple other nodes, NodeC, NodeD and NodeE, and it also knows which of these nodes is the best next hop for a data packet addressed to 188.8.131.52.
NodeE, then, has a direct route to the target node, and can deliver the data packet.
Thus, Source -> A -> B -> E -> Target is the route over which your computer and the target system can establish a connection.
This routing capability is the foundation of the Internet - it allows two computer systems to exchange data with each other.
How computer programs talk to each other over the Internet
By now, we have established a general understanding of how computers find other computers on the Internet, and how they can establish a network connection via IP addresses and data packet routing using these addresses.
We now need to zoom in even closer, and have a look at how exactly data is exchanged between a client and a server.
First of all, it’s important to note that it is not computers which exchange data through the Internet, it is applications which do.
Our computers are just the physical shell in which our applications live, providing the physical means like network cards and network cables (or radio signals) which enable remote applications to talk to each other.
In our case, the two applications talking to each other are the web browser application and the web server application.
Let’s update a diagram we have used before with more details:
Your computer system Web server system ┌───────────────────┐ ┌───────────────────┐ │ │ │ │ │ Web browser │ │ Web server │ │ application │ │ application │ │ ┌────────────┐ │ requests content │ ┌────────────┐ │ │ │ --│---│---------------------│--│--> │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ <--│---│---------------------│--│-- │ │ │ └────────────┘ │ responds with │ └────────────┘ │ │ │ content │ │ │ │ │ │ └───────────────────┘ └───────────────────┘
As you can see, the word server is used ambigously: it can mean the physical machine - the hardware - which is connected to a network like the Internet in order to serve data (e.g. a web server for web pages, a file server for files, a mail server for mails), but it can also mean the application - the software - which does the serving of web pages, files, or mails.
To distinguish between these two, I’m more precise in this text: I will talk about the server application when talking about the piece of software which serves web pages, and about the server system when talking about the computer which runs the server application.
The Internet mechanisms we have seen so far - DNS, IP addressing, and routing - are sufficient to establish a network connection between two computer systems, but not for making their applications talk to each other. If that was the case
How web browsers and web servers talk to each other
Let’s zoom even further in. We have learned how your web browser is able to find the IP address of the web server it wants to request using the Domain Name System, and we have learned how your web browser can establish a connection to the web server system available under this IP address using the routing mechanisms of the Internet.
Now that a connection is established, we will have a look at the actual data exchange.