Wednesday, 28 December 2016

BEST INTERVIEW QUESTIONS SERIES QUESTION 1 HOW ROUTER BUILD ROUTING TABLE

HOW ROUTER BUILD ROUTING TABLE


The main considerations while building the routing table are:

Administrative distance - This is the measure of trustworthiness of the source of the route.
 If a router learns about a destination from more than one routing protocol, administrative
distance is compared and the preference is given to the routes with lower administrative distance.
In other words, it is the believability of the source of the route.

Metrics - This is a measure used by the routing protocol to calculate the best path to a given
destination, if it learns multiple paths to the same destination. Each routing protocol uses a
different metric.

Prefix length

As each routing process receives updates and other information, it chooses the best path to any
 given destination and attempts to install this path into the routing table. For instance, if
EIGRP learns of a path toward 10.1.1.0/24, and decides this particular path is the best EIGRP
path to this destination, it tries to install the path it has learned into the routing table.

The router decides whether or not to install the routes presented by the routing processes based
on the administrative distance of the route in question. If this path has the lowest administrative
 distance to this destination (when compared to the other routes in the table), it's installed in
 the routing table. If this route isn't the route with the best administrative distance, then the
route is rejected.

To understand this better, let's look at an example. Assume a router has four routing processes
 running: EIGRP, OSPF, RIP, and IGRP. Now, all four of these processes have learned of various
routes to the 192.168.24.0/24 network, and each has chosen its best path to that network through
 its internal metrics and processes.

Each of these four processes attempts to install their route toward 192.168.24.0/24 into the
routing table. The routing processes are each assigned an administrative distance, which is
used to decide which route to install.





How Metrics Determine the Route Selection Process

Routes are chosen and built in the routing table based on the routing protocol's administrative 
distance. The routes learned from the routing protocol with the lowest administrative distance
 are installed in the routing table. If there are multiple paths to the same destination from 
a single routing protocol, then the multiple paths would have the same administrative distance
 and the best path is selected based on the metrics. Metrics are values associated with specific
 routes, ranking them from most preferred to least preferred. The parameters used to determine 
the metrics differ for different routing protocols. The path with the lowest metric is selected 
as the optimal path and installed in the routing table. If there are multiple paths to the same 
destination with equal metrics, load balancing is done on these equal cost paths.



Prefix Lengths

Let's look at another scenario to see how the router handles another common situation: 
varying prefix lengths. Assume, again, that a router has four routing processes running on
 it, and each process has received these routes:

EIGRP (internal): 192.168.32.0/26

RIP: 192.168.32.0/24

OSPF: 192.168.32.0/19

Which of these routes will be installed in the routing table? Since EIGRP internal routes have
 the best administrative distance, it's tempting to assume the first one will be installed. 
However, since each of these routes has a different prefix length (subnet mask), they're 
considered different destinations, and they will all be installed in the routing table.

Let's see how the forwarding engine uses the information from the routing table
 to make forwarding decisions.

Making Forwarding Decisions

Let's look at the three routes we just installed in the routing table, and see how they look on the router.

router# show ip route
     ....
     D   192.168.32.0/26 [90/25789217] via 10.1.1.1
     R   192.168.32.0/24 [120/4] via 10.1.1.2
     O   192.168.32.0/19 [110/229840] via 10.1.1.3
     ....
If a packet arrives on a router interface destined for 192.168.32.1, which route would the router choose? 
It depends on the prefix length, or the number of bits set in the subnet mask. Longer prefixes are always  preferred over shorter ones when forwarding a packet.

In this case, a packet destined to 192.168.32.1 is directed toward 10.1.1.1, because 192.168.32.1 falls
 within the 192.168.32.0/26 network (192.168.32.0 to 192.168.32.63). It also falls within the other two
 routes available, but the 192.168.32.0/26 has the longest prefix within the routing table (26 bits verses 24 or 19 bits).

Likewise, if a packet destined for 192.168.32.100 arrives on one of the router's interfaces, it's forwarded  to 10.1.1.2, because 192.168.32.100 doesn't fall within 192.168.32.0/26 (192.168.32.0 through 192.168.32.63),  but it does fall within the 192.168.32.0/24 destination (192.168.32.0 through 192.168.32.255). Again, it also falls into the range covered by 192.168.32.0/19, but 192.168.32.0/24 has a longer prefix length.



LAB :



Initially R1,R4 learns both the router 10.1.1.0/30,10.1.1.0/24 from R2 and R3 but if we trace route
10.1.1.1 we will reach to R2's 10.1.1.1/30 network because it is more specific CIDR or subnet mask.

If we run Eigrp on R1-R5 then we will not find 10.1.1.0/30 via R1 it comes via R5 because Eigrp AD value is better than RIP.

so to build the routing table routers first check the AD value , if it is same then it checks the metric value in both  the cases lower is better.

Router install all the routes with different CIDR value but forward according to the longest match,
as shown above in the diagram.

configuration steps are below:

!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 10.1.12.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial0/0
 ip address 10.1.14.1 255.255.255.0
 clock rate 2000000
!
interface FastEthernet0/1
 ip address 10.1.13.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial0/1
 ip address 10.1.15.1 255.255.255.0
 clock rate 2000000
!
router eigrp 100
 network 10.0.0.0
 no auto-summary
!
router rip
 version 2
 network 10.0.0.0
 no auto-summary
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R2(config-router)#do sh run
Building configuration...

Current configuration : 787 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback1
 ip address 10.1.1.1 255.255.255.252
!
interface FastEthernet0/0
 ip address 10.1.12.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
router rip
 version 2
 network 10.0.0.0
 no auto-summary
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end

R3(config-if)#do sh run
Building configuration...

Current configuration : 785 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback1
 ip address 10.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.1.13.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
router rip
 version 2
 network 10.0.0.0
 no auto-summary
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R4#sh run
Building configuration...

Current configuration : 862 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/0
 ip address 10.1.14.2 255.255.255.0
 clock rate 2000000
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/1
 no ip address
 shutdown
 clock rate 2000000
!
router rip
 version 2
 network 10.0.0.0
 no auto-summary
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
!
hostname R5
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback1
 ip address 10.1.1.1 255.255.255.252
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/0
 no ip address
 shutdown
 clock rate 2000000
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/1
 ip address 10.1.15.2 255.255.255.0
 clock rate 2000000
!
router eigrp 100
 network 10.0.0.0
 no auto-summary
!
ip forward-protocol nd
!
!
ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
-----

No comments:

Post a Comment