Skip main navigation

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.

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.

Structure of an IP header, containing the fields described above and below as well as 'Version', 'Total length', 'Protocol', 'Header checksum', 'Options (+padding)' and 'Data variable'.

  • 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.

You can find all the details about the header of IPv4 packets as well as the header of IPv6 packets on Wikipedia.

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.

An IP packet enters a circle labelled as a router. An arrow links its destination address to a routing table, with two columns, "NET" and "INT". The IP packet is shown leaving the router along a path to device A, a tablet. The router is also connected to devices B, C and D, a printer, a desktop, and a laptop respectively.

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 82.5.6.11, which is part of the ISP’s 82.0.0.0 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

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.

A globe showing connections being made between distant points.

It’s estimated that almost 50% of the world’s population has access to the internet.

Next up

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.

Questions

  • 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.

This article is from the free online

An Introduction to Computer Networking for Teachers

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education