How IP Routing Works

Yagi Studio

Routing is the process during which data packets are forwarded from one machine or device (technically referred to as a node) to another on a network until they reach their destinations.

When data is transferred from one device to another on an IP network, like the internet, the data is broken down into smaller units called packets. These units carry, along with the data, a header that contains a lot of information that help in their journey to their destination, a bit like what you have on an envelope. This information includes the IP addresses of the source and destination devices, packet numbers that will help reassemble them in order upon reaching the destination, and some other technical information. 

Routing is the same as switching with some very technical differences. IP routing uses IP addresses to forward IP packets from their sources to their destinations. IP adopts packet switching, in contrast with circuit switching. 

How Routing Works

Let us consider a scenario where Li sends a message from his computer in China to Jo's machine in New York. TCP and other protocols do their work with the data on Li's machine, then it is sent to the IP protocol's module, where the data packets are bundled into IP packets and sent over the network (internet).

These data packets have to cross through a lot of routers to reach their destination half the world away. The work these routers do is called routing. Each packet carries the IP addresses of the source and destination machine.

Each of the intermediate routers consults the IP address of each packet received. Based on this, each will know exactly in which direction to forward the packet. Normally, each router has a routing table, where data about the neighboring routers is stored. This data consists of the cost incurred into forwarding a packet in the direction of that neighboring node. The cost is in terms of network requirements and scarce resources. Data from this table is considered and used to decide the best route to take or the most efficient node to send the packet to on its way to its destination.

The packets go each one its own way and can move through different networks and take different paths. They all finally get routed to one same destination machine.

On reaching Jo's machine, the destination address and the machine address will match. The packets will be consumed by the machine, where the IP module on it will reassemble them and send the resulting data above to the TCP service for further processing. 


IP works together with the TCP protocol to ensure that the transmission is reliable, such that no data packet is lost, that they are in order and that there is no unreasonable delay. 

In some services, TCP is replaced with UDP (unified datagram packet) which does not cater reliability in transmission and just sends the packets over. For example, some VoIP systems use UDP for calls. Lost packets may not affect the call quality a lot.