The most fascinating part about networks is Routing. As the term indicates Routing describes the path a data packet takes to reach its destination. The term seems simple enough, but I will go step by step to describe the complex bits and bytes of the process of routing.
Every network device (for example a router, a computer, multilayer switches) contains a pre-configured routing table. On a host computer, this can be viewed by typing the “netstat –r” command or simply “route print” at the command line (in case of windows systems) and the “route” command for linux based systems.
In general, an IPv6 routing table and an interface list (in a case of a computer) will accompany the IPv4 table when u view the routing table of a device that supports both protocols. The routing table is composed of 6 parts as follows:-
- Network Destination: The IP address of the network of the device listed as the final destination for a packet.
- Netmask: Commonly termed as “Subnet Mask”. Separates the Network ID with the host ID.
- Gateway: The router through which the packet has to travel to reach to its destination.
- Interface: The IP address of the network adapter from which the packet originated (the local computer)
- Metric: A term which relates indirectly to the cost involved for the packet to reach to its destination if it takes the specified route. The lesser the metric, the better and faster the transfer of a packet.
- Persistent Routes: Manually added routes are termed as “Persistent” which stay even if the device reboots.
Let’s take an example route from the above routing table. The 6th entry in the routing table is shown as follows:-
192.168.91.0 255.255.255.0 On-link 192.168.91.1 4501
The “On-link” in the gateway column specifies that the packet can be directly forwarded to the specified network destination without any routing (i.e. the destination is on the local subnet)
It signifies that in order for a packet to travel from the interface with an IP address of 192.168.91.1 to the 192.168.91.0 network with a subnet mask of 255.255.255.0 it can to be directly forwarded to the network i.e. no routing required, with a cost of 4501.
If a gateway was specified e.g. 192.168.1.1 then the packet had to travel through it to reach the mentioned network destination. Complex algorithms are employed to determine each metric. Another thing to note here is the network destination specified as 0.0.0.0. This denotes all other network destinations other than the ones listed in the routing table.
By default, there are no persistent routes. But they can be added via command line.
To add a route manually type at the command line:-
route add “network destination” mask “netmask” “gateway”
e.g. route add 192.168.1.0 mask 255.255.255.0 192.168.1.1
e.g. route add 192.168.1.0 mask 255.255.255.0 192.168.1.1
To add a persistent route, type:
route add “network destination” mask “netmask” “gateway” –p
If no metric is specified, it can be automatically calculated by the device.
To delete a route type:
route delete “network destination”
route delete 192.168.1.0
Routing can be broadly classified into two categories: Static and Dynamic
Static Routing: Network devices have to be configured and updated manually.
Dynamic Routing: Network devices communicate with each other to share their routing information.
Routing is governed by Routing Protocols which can also be divided into two categories: Distance Vector Routing and Link State Routing Protocol.
Distance Vector Routing Protocols: Each router communicates all the networks it knows about to other routers to which it is directly attached. Communication takes place on a regular basis.
Link State Routing Protocols: Each router generates a network map. A router communicates information about the networks it is connected to through LSAs i.e. Link State Advertisements. But communication, unlike distance vector routing protocols, takes places only when a change is made to the network.
Distance Vector Protocols include RIP(Routing Information Protocol), RIPv2 and BGP(Border Gateway Protocol).
RIP and RIPv2 both support a maximum of 15 hops(1 hop= 1 jump from a router) and updates every 30 seconds. RIP uses broadcast communication whereas RIPv2 uses multicast communication for obtaining updates. Also, RIPv2 supports authentication whereas RIP does not.
Link State Protocols include OSPF (Open Shortest Path First) and IS-IS (Intermediate System to Intermediate System) Protocols.
OSPF is used in medium-large networks which gives preferences to certain paths based upon metrics.
IS-IS is designed with the OSI model. Interestingly, IS-IS is another name for a router.
Hybrid Routing Protocol includes Cisco’s EIGRP(Extended Interior Gateway Routing Protocol). It uses the Diffusing Update Algorithm (DUAL) whereby each router keep a copy of it’s neighbor’s routing table and it periodically checks the state of its neighbors by sending a packet.
Technorati Tags: Networks, Protocols, Routing