Basic of IP Routing Explained with Example

This article explains basic concepts of IP routing in detail with example. Routing is process of taking data from one device and sending it to another device in different network. Learn how routing connects two different IP networks step by step.

Every data packet has two addresses; source address and destination address. Destination address is used to deliver the data packet at destination. Source address is used to identify the sender device at destination device. If source address and destination address both belong to same network, no routing is required. If both addresses belong to different network, an intermediate device which can create route between both networks is required. Intermediate device is known as routing device. Routers and multilayer switches are the examples of routing device. In short connecting two different networks through a routing device (or a series of routing devices) is known as routing. Let’s understand this process in more detail with an example.

In following figure we have two PCs. Both are located in different network. Assume that PC0 sends a packet to PC1. It will go through the following steps.

Basic of routing

Upper layers (application, presentation, session) and transport layer prepare the data segments and handed down to network layer.

Network layer determines the routed protocol. Routed protocol is used to transmit user data packet across the network. IP and IPX are the example of routed protocol. CCNA exam syllabus includes only IP protocol. Thus we will also use IP protocol to explain the routing.

Network layer attaches IP header to the segment. With IP header segment becomes packet. IP header includes several fields. One of them is the destination address filed. It plays leading role in routing. Based on it network layer decides whether packet will remain in local network or goes to the remote network. All remote requests are sent to the default gateway. Default gateway is the router that switches packets between different networks.

Since our destination address is located in remote network, the packet need to be sent to the default gateway.

Network layer handed down this packet to Data link layer. Data link layer appends header. It adds source and destination MAC address in header and FCS in tail. After this modification packet becomes frame.

Data link layer uses ARP cache to resolve MAC address. If destination IP address is located in local network, hosts MAC address will be used. If destination IP address is located in remote network then default gateways MAC address will be used. In our example, destination address is located in remote network so default gateways MAC address will be used.

Frames are converted in signals. Physical layer puts these signals in media. Media carries these signals across the network.

Every device in collision domain receives these signals. Signals are converted in frame. Frame has destination MAC address. Device matches destination MAC address of frame with its own MAC address. If both addresses do not match, the frame is discarded.

Router receives these signals in FastEthernet port 0/0. It converts signals in frame. It compares MAC address. Since both MAC addresses are same, frame will be processed.

Packet will be pulled from frame. Packet contains destination IP address.

Router only matches network portion from IP address. Routing table is built from network address rather than host address.

Router checks its routing table for destination IP address network.

Routing table must have an entry for destination address network otherwise packet will be discarded immediately.

If router finds an entry for destination address network in routing table, the packet will be switched to the exit interface. In our example it will be FastEthernet 0/1.

Exit interface uses ARP protocol to find the MAC address of destination host. It converts packet in frame by attaching header and tail. In header it adds its MAC address in source MAC address field and destination hosts MAC address in destination MAC address field.

Frame is converted in signals. These signals are put in physical media.

All devices in collision domain receive these signals. PC1 also receives these signals. It converts signals in frame.

Frame has its MAC address in destination MAC address field. So it will pull packet from frame and hand over the packet to network layer.

Network layer checks IP address in destination IP address fields and compare it with its own IP address.

If both addresses match, packet will be processed. Segments will be pulled from packet.

Segments will be handed over to the transport layer.

Transport layer reassemble segments in data and gives it to upper layer.

Upper layers (session, presentation, application) process data and present it to user.

Same process is repeated every time when two hosts communicate with each other via router. Routing is a complex process. Every step given above has several additional steps and has added complexity. In this article we explained this complex process in easy steps. Following articles of this series will describe routing in more details.

ComputerNetworkingNotes CCNA Study Guide Basic of IP Routing Explained with Example