IP Addressing and Routing Part 2: IP Routing ProcessBy Stelios Antoniou
In Part 1 of IP Addressing and Routing we learned about the architecture and principles of the IP addressing scheme.Routers (and note: we are dealing with Cisco routers here), are responsible for routing packets to their final destinations by looking at the network portion of the address.
In today’s article we’ll get into the details of the IP routing process. We’ll take a look at the steps that need to be taken in order to be able to transfer packets from one network to the other using routers.
In my next article, I’ll give you the details on how routers exchange information about networks in the internetwork, so that they are able to route packets properly to their destination. I am talking about static and dynamic routing of course, details of which we’ll explore in Part 3 of IP Addressing and Routing.
Mastering the IP Routing Process
The process of IP routing is a standard process that takes place during the packet transmission phase and it is irrelevant of the network size and location. I will use a simple example to present this process. Once you understand this, then you can apply it to any network.
So let’s start by taking a look at the image below, where Host B on subnet 10.1.1.0/24 is trying to communicate with Host A on subnet 192.168.10.0/24.
Let’s assume that Host B tries to ping Host’s A IP address. To be able to do this, the following steps take place:
1. Internet Control Message Protocol (ICMP), constructs an echo request message. A snapshot of that message is shown below:
It can be seen that the ICMP echo request message consists, among others, of a type field (type=8), and the Data field which simply incorporates the alphabet.
Note: If you’re not familiar with the Internet Control Message Protocol (ICMP) see these two articles for more information:
- How to Troubleshoot Your Connections with Ping and Traceroute
- A Short Guide to Internet Control Protocols
2. This ICMP message is forwarded to the IP protocol which in turn is responsible for constructing a packet (this is how data are called at the network layer). This packet is shown in the image below, and it includes a Source and Destination IP address.
You can see that this packet originates from 10.1.1.6 and is destined for 192.168.10.2. IPv4 is used with no special Differentiated service classification. Note the protocol field within this packet — the protocol points to ICMP (0X01).
This is a flag that instructs the receiving host to forward the packet to the ICMP protocol which is situated on port 01 (0x means hexadecimal notation).
3. Once the packet is created, Host’s B protocol stack performs a table lookup to find whether the destination IP address is on the local network or a remote one. Obviously the IP resides on a remote network; therefore the packets have to be sent to the default gateway defined in the Host.
4. The default gateway of Host B in our case is configured to be 10.1.1.2. Communication within the LAN is achieved by using the MAC address of hosts, therefore to be able to send the packet to the default gateway, its MAC address needs to be resolved.
An ARP table lookup takes place on Host B to find whether the MAC address in question has already been resolved.
5. In our case default gateway’s MAC addresses has not been resolved yet; therefore host B (10.1.1.6) broadcasts an ARP request searching for the MAC address of 10.1.1.2. You can see this message below:
6. The default gateway responds to the ARP Request with an ARP Reply indicating its MAC address. By looking at the reply message below you can see that the MAC address of 10.1.1.2 (Gateway) is 00:02:b9:fa:4b:4f.
7. Now Host B is able to forward its Echo Request to Host A. At the same time it caches the hardware address of the default gateway so that it won’t initiate any new ARP requests for consecutive packets addressed to it. The gateway does the same — it caches the MAC address of Host B. The complete Echo Request can be seen below:
8. Prior to be transmitted, the data are framed. Control information is added to the frame and a Cyclic Redundancy Check (CRC) is performed on the frame.
The result of this is added at the end of the frame in a field called Frame Check Sequence (FCS). Finally the frame is put on the physical medium (wire) one bit at a time.
9. Upon receiving this frame, the gateway itself performs a CRC check on the complete frame and compares the result with the FCS field. If the two values do not match the frame is discarded.
If they match, the MAC address is also checked to see if this frame is destined for the gateways interface. If it’s a match then the packet according to the ether type field is handed to the network layer and the rest of the frame control fields are discarded.
10. The gateway inspects the destination IP address within the packet and finds out that it belongs to a directly connected network on the gateway. Keep in mind that routers and gateways are able to forward only the packets destined for networks that are known to them either by static routes or dynamic learning routes.
11. To properly address the packet to the right recipient, the gateway needs to know the MAC address of that recipient (192.168.10.2). If the later is not in its ARP cache then it has to go through the usual process of resolving IP-to-MAC addresses by issuing an ARP Request. You can see this message below:
12. Host A replies back with its MAC address as seen in the figure below:
13. Finally the ICMP echo Request (ping) can now be appropriately deliver to its final destination. There, Host A upon receiving this frame performs the necessary CRC and MAC address checks and if everything goes alright it passes the Echo Request to the ICMP which in turns constructs an Echo Reply.
The reply and every consecutive message follow the same procedure already described to eventually reach the intended recipient.
The routing process is the same, even if you have a network with fifty routers, the process does not change. The only difference is that in larger networks packets have to cross several boundaries and traverse several hops before reaching their final destination. All you have to keep in mind is that:
- MAC addresses have local meaning in the sense that packets passing through a given link need to be addressed to the recipient of that specific link. That is the reason why source and destination MAC addresses within the frame are changing at each hop.
- Routers, to be able to route packets to their destination need to know somehow where the destined network is located so that they can forward the packets out from the proper interface. This information can be either statically assigned or dynamically learned.
Don’t miss Part 3 of IP Addressing and Routing.
About the Author
Stelios Antoniou (CCNA, NET+, MOUS) holds a BSc in Electronic Engineering and an MSc in Communication Networks. He has over three years of experience in teaching MS Office applications, networking courses and GCE courses in Information Technology. Stelios is currently working as a VoIP Engineer in a Telecom company, where he uses his knowledge in practice. He has successfully completed training on CCNP topics, Linux and IMS. His enthusiasm, ambition and knowledge motivate him to offer his best. Stelios has written many articles covering Cisco CCENT, CCNA, and CCNP.