Basic of IP Routing Explained with Example

This tutorial explains IP routing in detail. Learn differences between routed protocols and routing protocols, what the IP routing is, and how the IP routing works in a computer network.

What is IP routing?

IP routing is a process of transferring data from one network to another as IP packets. By default, hosts of different networks cannot communicate with each other. If two hosts located in different IP networks want to communicate with each other, they use IP routing.

Routers provide IP routing. A router is a specialized device that connects different IP networks. Let’s take a simple example. Suppose two IP hosts; and want to communicate. Since they both belong to the different IP networks, they need a router to communicate.

The following image shows this example.

router connecting two different ip networks

The complete IP routing process relies on two types of protocols; routed protocols and routing protocols. Before we understand how the IP routing works, let’s understand the differences between both types of protocols.

Routing protocols v/s Routed or Routable protocols

A routed protocol is used to encapsulate the data that is exchanged between the source host and the destination host. In IP routing, the IP protocol is used as the routed protocol.

By using the IP protocol, a source host packs data pieces and adds the source address and the destination address on each data piece. A data piece with both addresses (source and destination) is known as the IP packet.

Any router that works on a path that connects the source host to the destination host uses both (source and destination) addresses to find out where the packet came from and where it will go.

Routing protocols

Routers use a routing protocol for the following purposes.

To figure out all available paths of the network. A router stores these paths in a table known as the routing table.

To select the best and fastest path to get a destination host. When a router receives an IP packet, the router checks its routing table and compares all available paths to get the destination network of the received IP packet and selects the fastest path from all available paths.

RIP, IGRP, EIGRP, and OSPF are examples of routing protocols.

routed protocols and routing protocols

How does IP routing work?

The process of IP routing begins when a host creates a data packet for a host that is located in another network and ends when that destination host receives the packet. To understand this process in detail, let’s take a simple example.

The following image shows the layout of a network. In this network, PC0 and PC1 are connected to PC2 via four routers; R1, R2, R3, and R4.

ip routing example

Suppose, an application running on PC0 wants to send some data to PC1. The application calls the IP protocol of PC0 and hands that data over to the IP protocol. The IP protocol packs data into packets and adds source and destination addresses to each packet.

After this, the IP protocol uses another protocol known as ARP protocol to figure out whether the destination address (PC1) is located in the local network (the same IP network) or is located in the remote network (another IP network).

If the destination address is located in the same IP (local) network, the IP protocol sends packets directly to the destination host.

The entire routing process is controlled by the routed (IP) protocols of PC0 and PC1.

ip routing through routed protocol

Now suppose that the same application wants to send data to PC2. The same process is repeated until the packet forwarding decision is made by the IP protocol. This time, since the destination host (PC2) is located in the remote network (another IP network), the IP protocol sends packets to the default gateway.

A default gateway is an interface of a router that connects the local network with the remote network. By default, an IP protocol forwards all packets to the default gateway except the packets that belong to the local IP network.

The default gateway router not only keeps records of all remote networks but also keeps records of all available paths for each remote network. A router maintains these records in the routing table. A typical routing table entry consists of two pieces; the network address and the interface on which that network is available.

When a router receives a packet on any of its interfaces, it reads the destination network of that packet and finds that network in the routing table. If the routing table contains a record for that network, the router uses that record to forward the packet. If the routing table doesn’t contain a record for that network, the router discards that packet.

If multiple paths to a remote network exist, the router chooses the fastest path from them.

In our example, the default gateway router R1 has two paths to reach to PC2's network. When it receives packets for PC2 from PC0, it compares both paths and chooses the fastest path to forward packets.

ip routing through routing protocols

PC2 receives packets from its default gateway router R4. The entire routing process is controlled by both types of protocols; routed and routing protocols.

That’s all for this part. In the next part of this tutorial, I will explain the basic concepts of routing protocols. If you like this tutorial, please don’t forget to share it with friends through your favorite social network.

ComputerNetworkingNotes CCNA Study Guide Basic of IP Routing Explained with Example