Saturday, August 1, 2020

Network Routing For Beginners - A Step by Step Breakdown... Vol 9 rel 10

Routing Concepts - Routing Process

The term IP routing refers to the process of taking a packet from one host and sending it to


another host on a different network. The routing process is the usually done by devices called routers. You probably have this device at home, providing you with the Internet access.

Routers examine the destination IP address and make their routing decisions accordingly. To determine out which interface the packet will be forwarded, routers use routing tables which list all networks for which routes are known. Consider the following example:

We shall review IP routing between two hosts, H1 and H2 depicted below through two separate Routers, R1 and R2. We will explain step by step how an IP packet from host 1 makes it to host 2.

H1 Step 1: Examine

Host 1 wants to send an IP packet from itself 192.168.1.1 to Host 2 192.168.2.2.

To do that, Host 1 will have to check and see if destination is in its own subnet or outside its own subnet.  Host 1 does so by looking at his own IP address and its own subnet mask.

Reviewing the IP address and subnet mask, we can clearly see that 192.168.2.2 is outside of the 192.168.1 network; hence, we must send it to the default gateway.


H1 Step 2: Encapsulate 

Host 1 will create this IP packet with source 192.168.1.1 and destination 192.168.2.2 and then it will build an Ethernet Frame but its own MAC address (fa16.3e87.9c2a) is the source and R1 (In this case the default gateway – 192.168.1.254 ) will be its destination.

If Host 1 doesn't know the Mac address of R1, it has to do an ARP request, but first it looks at ARP table you can see it already did the ARP request, and it figured out the Mac address of R1 is fa16.3e3f.fd.3c

 


H1 Step 3: Forwarding

Sends the frame.  This is how Host 1 makes a frame holding the IP packet and sends it to R1.

R1 Step 1: Examine

The first thing R1 does is check if the FCS (frame check sequence) of the frame is correct if it is not correct then the frame is probably corrupt, and the frame will be discarded.  Note - there is no error recovery in Ethernet, so the frame will be discarded.   We rely on upper network layers like TCP on the transport layer for things like error recovery. Hence, the first thing we check the frame check sequence.

Now, if the FCS is correct, then we look at the destination MAC address.  Now R1 has a few options here:

  1. If it sees its own MAC address as the destination it will process the frame...
  2. If the destination is a broadcast, it discards it.  Routers do not broadcast; it simply drops the packet as soon as it notices a broadcast address. The primary role of router is to separate broadcast domains. Broadcast domains are restricted to layer 2 devices like switch. 
  3. If the destination is a multicast address, it forwards to a multicast group that router is listening to.

In this case the destination is the Mac address of the router and that means that we will process this frame.

R1 Step 2: Decapsulate:  

R1 will take his Ethernet frame and it will be de-encapsulated that IP packet from the existing Ethernet frame and discard it.  Taking the remaining IP packets, it performs an IP Header checksum.  IP Header Checksum is kind of like the FCS Ethernet frame check.   R1 reviews the IP packet.  If the checksum is correct then it will process the IP packet, otherwise drop it.

R1 Step 3: Decision-Making

R1 will look for the destination of the IP packet and destination is IP address (192.168.2.2) and compare it to its routing table.

R1 reviews its routing table to see if it has a route that matches this destination (192.168.2.2). 

Looking at the routing table, we see a route for this entry matches one 192.168.2.0/24 and we can find a next hop address.  Here we see that we can go to 192.168.12.2 to reach this network, 192.168.12.2.

From the diagram (above), we see that this address of R2.  So R1 now must figure out how to reach 12.2.

Returning to our Routing table, we see that the address can be reached since it is directly connected to R1.  It shows that we can use GigabitEthernet 0/2 interface (highlighted).  

R1 Step 4: Encapsulate

R1 will take the IP packet and it will decrease the time to live (TTL) field by one.  The time to live field is there to make sure that if you have a routing loop, the data packet doesn't route around forever, so whenever a packet goes through a router, it will decrease the time to be field by one.  By decreasing TTL it changes the header checksum so R1 will have to recalculate the header checksum and it is then done processing the IP packet.

R1 will take the IP Packet and put it in An Ethernet frame when its own address as the source then it must enter R2 MAC address as the destination.  To get the destination MAC address, it will have to check the ARP table for that…

Running the “show ip arp” command shows we have an entry in for 192.168.12.2.  Using the corresponding MAC address,

R1 places it in the destination field in the Ethernet frame.  Now it there is no entry here, R1 does an ARP request and wait for the table to populate.

R1 Step 5: Forwarding

R1 sends the packet.  That is how this packet makes it from R1 to R2.

R2 Step 1: Examine   

R2 gets the Ethernet frame it starts by checking the FCS of the Ethernet frame.  If that is correct, then it will look if Ethernet frame has a correct destination which checks out because it is R2 address which is the destination.  Otherwise it discards the frame.  Note - there is no error recovery in Ethernet, so the frame will be discarded.   We rely on upper network layers like TCP on the transport layer for things like error recovery. Hence, the first thing we check the frame check sequence.

R2 Step 2: Decapsulate:

R2 then De-encapsulates that IP packet from the frame, and throws the frame away, it doesn’t need it anymore and then it first checks the IP header Checksum,  which is correct, if not it will drop the IP packet.  As with Ethernet, IP also does not have any error recovery, it also relies on the transport layer for that. 

R2 Step 3: Decision-Making

R2 then will look at the destination field of the IP packet. Upon discovering the destination of 192.168.2.2 it will review its routing table.  R2 will look for an entry and the entry are directly connected for this Network and R2 will use this interface to reach it.

R2 Step 4: Encapsulate

R2 will take the IP packet and it will decrease the time to live (TTL) field by one.   Like R1, by decreasing TTL it changes the header checksum so R2 will have to recalculate the header checksum and it is then done processing the IP packet.

R2 will take the IP Packet and put it in an Ethernet frame when its own address as the source then it must enter H2 MAC address as the destination.  To get the destination MAC address, it will have to check the ARP table for that…

Running the “show ip arp” command shows we have an entry in for 192.168.12.2.  Using the corresponding MAC address,

R2 places it in the destination field in the Ethernet frame.  Now it there is no entry here, R2 does an ARP request and wait for the table to populate.

R2 Step 5: Forwarding

R2 sends the packet.  That is how this packet makes it from R2 to H2


H2 Step 1: Examine

H2 gets the Ethernet frame it starts by checking the FCS of the Ethernet frame.  If that is correct, then it will look if Ethernet frame has a correct destination which checks out because it is H2 address which is the destination.  Otherwise it discards the frame. 

H2 Step 2: Decapsulate:

H2 then De-encapsulates that IP packet from the frame, and throws the Ethernet frame away, it doesn’t need it anymore and then it first checks the IP header Checksum,  if it is correct it will process the packet, if not it will drop the IP packet.  As with Ethernet, IP also does not have any error recovery, it also relies on the transport layer for that. 

H2 Step 3: Decision-Making

H2 then will look at the destination field of the IP packet. Upon discovering the destination of 192.168.2.2 it will see that it is its own address.

H2 Step 4: Forwarding

H2 will forward the data up to the transport layer where it will be processed further.


Conclusion: 

That is basically how a packet is routed from one route to the other.

 _________________________________________

We would like to thank our sponsors, for without them - our fine content wouldn't be deliverable!


Source
So “Once more unto the breach, dear friends, once more;”
____________________________________________________________
About Rick Ricker
An IT professional with over 23 years' experience in Information Security, wireless broadband, network and . Infrastructure design, development, and support.
Currently a Computer Science Instructor at CSULB

No comments:

Post a Comment

Thanks for your input, your ideas, critiques, suggestions are always welcome...

- Wasabi Roll Staff