Useful Articles


Basic IP Routing Rules

Basic IP Routing Rules

When we try to connect to a remote subnet/prefix from a router (for example, Ping, Telnet, or FTP), following basic routing rules are followed in given order.
  1. Select the route with longest mask (subnet mask).
  2. Select the route with best Administrative Distance.
  3. Select the route with best metric.
  4. If equal metric paths/routes exist, perform load sharing.
Let's discuss all 4 rules one by one in detail.

Basic IP Routing Rules - Rule 1

Select the route with best mask (subnet mask)

Let's assume there few routes in routing table of  a Router R1 in a network as shown below. If we want to ping, which route out of  these 4 will be preferred? I hope you have guessed it correctly. If not, R1 will use the route learned via OSPF i.e. because it has best mask (or longest mask) for our destination

   D  [90/122881] via Serial 1/1
   S   via Serial 1/1
   O  [110/65] via Serial 1/1
   R  [120/2] via Serial 1/1

Basic IP Routing Rules - Rule 2

Select the route/path with best Administrative Distance

Let's assume that Router R1 receives 3 updates for from protocols OSPF, EIGRP, and RIP. R1 will install the route from protocol EIGRP in its routing-table because it has least AD (90). To understand Administrative Distance (AD) in detail, kindly read the article "Administrative Distance of IP Routing Protocols - Cisco".

Basic IP Routing Rules - Rule 3

 Select the route with best metric

Let's assume that R1 is only running a single routing protocol RIP. It receives a route from 3 neighboring routers R2, R3, R4 with metric 2, 4, and 6 respectively.
If we will ping, R1 will prefer to reach from the neighbor R2 from which it has received the route( with metric 2. R1 will only install this route (from neighbor R2 with metric 2) in its routing table.

Basic IP Routing Rules - Rule 4

 If metric is equal for more than 1 path, do load-sharing

Let's again assume that R1 is only running a single routing protocol RIP. It again receives a route from 3 neighbor routers R2, R3, R4 this time with equal metric of 2. R1 will install all 3 routes/paths in its routing table and do load-sharing as shown in output from R1 below:

Basic IP Routing Rules

All IP routing protocols are capable of load balancing  on maximum 6 equal-cost paths. By default, all IP protocols can load balance on to 4 paths, with an exception of BGP where only one entry is default. To change the load balancing from 4 to more paths (for example 6) use below command on the router.

Router(config)#router rip
Router(config-router)#maximum-paths 6

If you understood the concept and liked this article, kindly share the same with your friends.

Post a comment