This blog is going to talk about the specific of the routing process. In general there are mainly three steps that a router needs to go through
1. Routing : The goal of the routing is the to find out what interface is going to send the packet out. So if the packet comes in from fa0/0 it has to make decision of its outgoing interface whether it is fa0/1 or other interface available
Once the decision is made of the outgoing interface then it goes through the next process called as Switching Process.
2. Switching : Main goal is to move packet between interfaces where I will write a separate blog about different types of switching mechanism like Cisco Express Forwarding ( CEF), Packet Switching, Fast Switching.
The last step is when the packet arrives to be forwarded out of the interface router needs to re-encapsulate the packet
3. Encapsulation : Build layer 2 header also known as Layers 2 rewrite.
THE ROUTING PROCESS
- Step 1 : Find the longest match
- - show ip route 1.2.3.4
- 1.0.0.0/8
- 1.2.0.0/16
- 1.2.3.0/24
- Which route to choose ?
It will now be performing binary comparison between the destination 1.2.3.4 and all those routes available in the routing table (i.e. 1.0.0.0/8 , 1.2.0.0/16, 1.2.3.0/24) and find out which routes has the bits in common with the destination 1.2.3.4. 1.2.3.0/24 will have more bits in common compared to other two routes whereas the most specific routes in common for 1.2.3.4 would be 1.2.3.4/32 also know as Host Route where it is exact match for all 32 bits. The least specific match would be 0.0.0.0/0 only know to be as gateway of last resort or default route.
The router needs to now find out what interface is that route located on ? It does with the help of recursive routing lookup
- Step 2 : Perform recursive lookup
- 1.2.3.4 via 5.6.7.8
- 5.6.7.8 via 9.0.1.2
- 9.0.1.2 via 3.6.7.8
- >> 3.6.7.8 directly connected, FastEthernet0/0
What this basically means is that one route points to another and another routes point to another route until and unless it finds out a interface to send the packet out as mentioned above. The router in our case will do another lookup for 5.6.7.8 and same goes to 9.0.1.2 and 3.6.7.8 until it finds out the connected interface.
THE SWITCHING PROCESS
Switching mainly defines about how packets are moved from the input interface to the output interface. basically we can relate it to saying moving packet between the interfaces. There are many different switching paths available
- Process Switching : ask the CPU about every single packet
- Fast Switching : route caching process where you ask the CPU about the first packet and then uses the cache for the rest of it.
- CEF ( Cisco Express Forwarding) : by far the most common and is available by default.
I will be talking about all these 3 switching process more in detail in my other blog.
THE ENCAPSULATION PROCESS
Lastly we have the encapsulation process where router needs to build the layer 2 header based on the outgoing media also sometimes referred to as layer 2 packet rewrite. Let's take an example.
Assuming Host A has packets to go to Host B in the following all-Ethernet connection:
Host A --- Switch A --- Router A --- Router B --- Switch B --- Host B
Host A and B are in different subnets, and their default gateways are Router A and Router B interfaces.
When Router A will forward the packet towards to Router B , it will remove the Layer 2 addressing sent by Host A with its outgoing interface as the source MAC address and it will use Router B's interface closest to it as the destination MAC address. Once the frame has been recreated, it will send it.
Reference
https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipswitch_poview/configuration/15-s/isw-poview-15-s-book.html#GUID-8D568005-3AF8-494D-B32D-B878EFBA8328
Brian Mcgahan, CCNP Route Switch Course v3
Comments
Post a Comment