But let's introduce a third network, Network C.
It has an address space of 172.16.1.0/23.
There is a second router connecting network B and network C.
It's interface on network B has an IP of 10.0.0.1 and
its interface on Network C has an IP of 172.16.1.1.
This time around our computer at 192.168.1.100
wants to send some data to the computer that has an IP of 172.16.1.100.
We'll skip the Data Link Layer stuff, but
remember that it's still happening, of course.
The computer at 192.168.1.100 knows that 172.16.1.100 is not on its local network,
so it sends a packet to its gateway, the router between Network A and Network B.
Again, the router inspects the content of this packet.
It sees a destination address of 172.16.1.100 and
through a lookup of its routing table, it knows that the quickest
way to get to the 172.16.1.0/23 network is via another router.
With an IP of 10.0.0.1.
The router decrements the TTL field and
sends it along to the router of 10.0.0.1.
This router then goes through the motions,
knows that the destination IP of 172.16.1.100 is directly connected and
forwards the packet to its final destination.
That's the basics of routing.
The only difference between our examples and
how things work on the Internet is scale.
Routers are usually connected to many more than just two networks.
Very often, your traffic may have to cross a dozen routers before it reaches
its final destination.
And finally, in order to protect against breakages,
core Internet routers are typically connected in a mesh,
meaning that there might be many different paths for a packet to take.
Still, the concepts are all the same.
Routers inspect the destination IP, look at the routing table to determine which
path is the quickest and forward the packet along the path.
This happens over and over.
Every single pocket making up every single bit of traffic all over the Internet
at all times.
Pretty cool stuff?