Wednesday 28 December 2016

BEST INTERVIEW QUESTION DIFFERENCE BETWEEN LINK STATE & DISTANCE VECTOR PROTOCOL Q3

DIFFERENCE BETWEEN LINK STATE & DISTANCE VECTOR PROTOCOL

There are two major classes of routing protocol: distance vector and link-state. It's easy to remember which protocols belong to either class, but comprehending the differences between the two classes takes a bit more effort.
Distance vector routing is so named because it involves two factors: the distance, or metric, of a destination, and the vector, or direction to take to get there. Routing information is only exchanged between directly connected neighbors. This means a router knows from which neighbor a route was learned, but it does not know where that neighbor learned the route; a router can't see beyond its own neighbors. This aspect of distance vector routing is sometimes referred to as "routing by rumor." Measures like split horizon and poison reverse are employed to avoid routing loops.
Link-state routing, in contrast, requires that all routers know about the paths reachable by all other routers in the network. Link-state information is flooded throughout the link-state domain (an area in OSPF or IS-IS) to ensure all routers possess a synchronized copy of the area's link-state database. From this common database, each router constructs its own relative shortest-path tree, with itself as the root, for all known routes.

Consider the following topology.
Both distance vector and link-state routing protocols are suitable for deployment on this network, but each will go about propagating routes in a different manner.
Distance Vector
If we were to run a distance vector routing protocol like RIP or EIGRP on this topology, here's how R1 would see the network, assuming each link has a metric of 1 (locally connected routes have been omitted):
show the output at R1:
R1#
*Mar  1 00:12:50.559: %SYS-5-CONFIG_I: Configured from console by console
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 8 subnets
C       10.1.13.0 is directly connected, Serial0/0
C       10.1.12.0 is directly connected, FastEthernet0/0
R       10.0.2.0 [120/1] via 10.1.12.2, 00:00:09, FastEthernet0/0
R       10.0.3.0 [120/1] via 10.1.13.2, 00:00:26, Serial0/0
C       10.0.1.0 is directly connected, Loopback1
R       10.0.4.0 [120/2] via 10.1.13.2, 00:00:26, Serial0/0
R       10.1.23.0 [120/1] via 10.1.13.2, 00:00:26, Serial0/0
                  [120/1] via 10.1.12.2, 00:00:09, FastEthernet0/0
R       10.1.34.0 [120/1] via 10.1.13.2, 00:00:11, Serial0/0

R4#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 8 subnets
R       10.1.13.0 [120/1] via 10.1.34.1, 00:00:16, FastEthernet0/0
R       10.1.12.0 [120/2] via 10.1.34.1, 00:00:16, FastEthernet0/0
R       10.0.2.0 [120/2] via 10.1.34.1, 00:00:16, FastEthernet0/0
R       10.0.3.0 [120/1] via 10.1.34.1, 00:00:16, FastEthernet0/0
R       10.0.1.0 [120/2] via 10.1.34.1, 00:00:16, FastEthernet0/0
C       10.0.4.0 is directly connected, Loopback1
R       10.1.23.0 [120/1] via 10.1.34.1, 00:00:16, FastEthernet0/0
C       10.1.34.0 is directly connected, FastEthernet0/0
R4#

Notice that although R1 has connectivity to all subnets, it has no knowledge of the network's structure beyond its own links. R4 has even less insight:
Because they do not require routers to maintain the state of all links in the network, distance vector protocols typically consume less overhead at the expense of limited visibility. Because routers have only a limited view of the network, tools like split horizon and poision reverse are needed to prevent routing loops.
Link-State
Now, let's look at the same topology running a link-state routing protocol (in a single area). Because each router records the state of all links in the area, each router can construct a shortest-path tree from itself to all known destinations. Here's what R1's tree would look like:

R4 has constructed its own shortest-path tree, different from that of R1:
Although maintaining link-state information for the entire area typically requires more overhead than does processing advertisements only from direct neighbors, but provide more robust operation and scalability.
now in case of ospf output at R1 is
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
C       10.1.13.0/24 is directly connected, Serial0/0
C       10.1.12.0/24 is directly connected, FastEthernet0/0
O       10.0.3.1/32 [110/65] via 10.1.13.2, 00:00:52, Serial0/0
O       10.0.2.1/32 [110/11] via 10.1.12.2, 00:00:52, FastEthernet0/0
C       10.0.1.0/24 is directly connected, Loopback1
O       10.0.4.1/32 [110/75] via 10.1.13.2, 00:00:52, Serial0/0
O       10.1.23.0/24 [110/74] via 10.1.12.2, 00:00:52, FastEthernet0/0
O       10.1.34.0/24 [110/74] via 10.1.13.2, 00:00:55, Serial0/0

and output at R4 is :

R4#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
O       10.1.13.0/24 [110/74] via 10.1.34.1, 00:01:27, FastEthernet0/0
O       10.1.12.0/24 [110/84] via 10.1.34.1, 00:01:27, FastEthernet0/0
O       10.0.3.1/32 [110/11] via 10.1.34.1, 00:01:27, FastEthernet0/0
O       10.0.2.1/32 [110/75] via 10.1.34.1, 00:01:27, FastEthernet0/0
O       10.0.1.1/32 [110/75] via 10.1.34.1, 00:01:27, FastEthernet0/0
C       10.0.4.0/24 is directly connected, Loopback1
O       10.1.23.0/24 [110/74] via 10.1.34.1, 00:01:29, FastEthernet0/0
C       10.1.34.0/24 is directly connected, FastEthernet0/0

Summary:
With distance vector routing, each node has information only about the next hop:
Distance vector routing makes
poor routing decisions if 
directions are not completely correct (e.g., because a node is down).
If parts of the directions incorrect, the routing may be incorrect until
 the routing algorithms has re-converged.

In link state routing, each node has a complete map of the topology
If a node fails, each node can calculate the new route  
Difficulty: All nodes need to have a consistent view of the network

Each node requires complete topology information
Link state information must be flooded to all nodes
Guaranteed to converge

1. Each router establishes a relationship (“adjacency”) with its neighbors
2.Each router generates link state advertisements (LSAs) which are distributed
 to all routers LSA = (link id, state of the link, cost, neighbors of the link)
3. Each router maintains a database of all received LSAs (topological database or
 link state database), which describes the network has a graph with weighted edges
4. Each router uses its link state database to run a shortest path algorithm 
(Dijikstra’s algorithm) to produce the shortest path to each network


Lab Section: 


configuration on R1

router rip
ver 2
no auto
net 10.0.1.0
net 10.1.12.0
net 10.1.13.0

configuration on R2

router rip
ver 2
net 10.1.12.0
net 10.0.2.0
net 10.1.23.0

configuration on R3

router rip
ver 2
net 10.1.13.0
net 10.1.23.0
net 10.1.34.0
net 10.0.3.0

configuration on R4

router rip 
ver 2
no auto
net 10.1.34.0
net 10.0.4.0

sh ip route on R1

     10.0.0.0/24 is subnetted, 8 subnets
C       10.1.13.0 is directly connected, Serial0/0
C       10.1.12.0 is directly connected, FastEthernet0/0
R       10.0.2.0 [120/1] via 10.1.12.2, 00:00:15, FastEthernet0/0
R       10.0.3.0 [120/1] via 10.1.13.2, 00:00:14, Serial0/0
C       10.0.1.0 is directly connected, Loopback1
R       10.0.4.0 [120/2] via 10.1.13.2, 00:00:14, Serial0/0
R       10.1.23.0 [120/1] via 10.1.13.2, 00:00:14, Serial0/0
                  [120/1] via 10.1.12.2, 00:00:15, FastEthernet0/0
R       10.1.34.0 [120/1] via 10.1.13.2, 00:00:16, Serial0/0

for ospf 


configuration on R1
router ospf 1
net 10.1.12.0 0.0.0.255 ar 0
net 10.1.13.0 0.0.0.255 ar 0
net 10.0.1.0 0.0.0.255 ar 0

configuration on R2
router ospf 1
net 10.1.12.0 0.0.0.255 ar 0
net 10.0.2.0 0.0.0.255 ar 0
net 10.1.23.0 0.0.0.255 ar 0

configuration on R3
router ospf 1
net 10.1.13.0 0.0.0.255 ar 0
net 10.1.23.0 0.0.0.255 ar 0
net 10.1.34.0 0.0.0.255 ar 0
net 10.0.3.0 0.0.0.255 ar 0

configuration on R4
router ospf 1
net 10.1.34.0 0.0.0.255 ar 0
net 10.0.4.0 0.0.0.255 ar 0



sh ip route on R1

     10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
C       10.1.13.0/24 is directly connected, Serial0/0
C       10.1.12.0/24 is directly connected, FastEthernet0/0
O       10.0.3.1/32 [110/65] via 10.1.13.2, 00:00:16, Serial0/0
O       10.0.2.1/32 [110/11] via 10.1.12.2, 00:00:16, FastEthernet0/0
C       10.0.1.0/24 is directly connected, Loopback1
O       10.1.23.0/24 [110/74] via 10.1.12.2, 00:00:16, FastEthernet0/0
O       10.1.34.0/24 [110/74] via 10.1.13.2, 00:00:16, Serial0/0


             -----Thanx----

No comments:

Post a Comment