IP Packets, Routers and Routing
Previously, we looked at a simplified IP packet, with fields for the source and destination addresses as well as the data it transports. In a real IP packet header there are several other fields.
- IHL indicates the header length.
- Packets use Type of Service to request special treatment (e.g. being put at the front of any queues).
- The identification, flags, and fragmentation offset fields keep track of each fragment when an IP packet is split up into smaller packets.
- The time to live is set when the IP packet is sent off, and the number is reduced by 1 each time the packet goes through a router. When the time to live gets to 0, the packet is deleted. This stops packets from circulating in a loop.
Routers and routing
Routers got their name because they route IP Packets across networks: a router device connects different links. It examines IP packet headers, looking at the destination address and consulting a routing table of known networks. The table indicates which connections to send the packet on as the next link. The connections on a router are called interfaces: through the router, they interface between different link types.
In the animation, an IP packet arrives at a router, which compares the packet’s destination address with the networks in the routing table. The packet is identified as belonging to network A, so the router routes it out of interface 1.
Often, routers learn how to reach distant networks by exchanging information with their neighbouring routers and building their own routing tables. This exchange of information to learn about other networks is called a routing protocol. You can find more information about routing protocols on Wikipedia.
Note: the term ‘routing protocol’ can be easily confused with routed protocol. IP is a routed protocol: routers examine IP packets and route them out of an interface based on the destination IP address.
Routing on Home and Small Business Networks
A home or small-business network usually has a single LAN, which a router connects to an ISP.
Each of the network’s devices, including the actual interface on the router for the LAN, will have a 192.168.1.X address. The internal LAN’s network address is therefore 192.168.1.0.
The Router’s WAN interface has the address 184.108.40.206, which is part of the ISP’s 220.127.116.11 network.
So the router is connected to two different IP networks, which are automatically placed into the routing table. The default network, 0.0.0.0, gets configured so it sends data out via the WAN interface and onto the next router.
Packet switching and circuit switching
Each router examines and sends each IP packet individually — this is called packet switching. If the network changes, due to congestion or faults, routers can use an alternative interfaces to reach a destination. So packets may travel over different routes to reach the same destination.
Possible point of confusion: despite the fact that this is called ‘packet switching’, no switch devices are involved. Switches switch data frames between ports, whereas routers route IP packets between interfaces.
Telephone systems use circuit switching: they send an initial packet to the destination, and along its path, this first packet reserves capacity on all of the links it uses. It sets up a fixed route on each router specifically for this connection. This creates a guaranteed connection from end to end for the duration of the call. If capacity is unavailable, then no connection is made and the system terminates the call.
The internet is the interconnection of all the different networks that we have discussed, and that people have created and are using in different capacities. For example:
- Home users with single LANs
- Users around the world connecting to ISPs through smartphones
- Small and large companies with LANs and WANs
- Governments and ISPs with WANs that span the globe
ISPs interconnect with other ISPs, and this connects everything together into a gigantic WAN. This is the internet, which you’ll learn more about next week.
It’s estimated that almost 50% of the world’s population has access to the internet.
In the next step, we’ll show you how you can see the routers that your IP packets pass through on the way to a web server.
- Can you guess where fragmented IP packets are reassembled, and why that location?
- What do you think happens if a fragment of an IP packet fails to arrive?
- If a large corporation has multiple connections to the internet via different ISPs, how does it choose which way to send traffic?
Join in the conversation in the comments below to share your ideas.