KEMBAR78
routing algorithm | PPTX
Roll_No:-1703 Paper_Code:-BCA_304
Data Communication & Networking
• Router
• Properties of routing algorithm
• Types of routing algorithm
• Distance Vector Routing Algorithm
• Advantages & Disadvantages of DVR
• Link State Routing Algorithm
• Advantages & Disadvantages of LSR
• A router is located at the gateway
• It routes packets as they travel from one network to another network
• The router is connected to at least two networks
• Find path
• Forward packet
• Find alternative path
• Forward packet
• Repeat until power off
Routing is the process of forwarding of a packet in a network so that it reaches its
intended destination.
• Correctness The routing should be done properly and correctly so that the
packets may reach their proper destination
• Simplicity The routing should be done in a simple manner
• Robustness Once a major network becomes operative,it may be expected to
run continouslyfor years without any failures.
• Stability The routing algorithms shoulb be stable under all possible
circumstance
• Fairness Every node connected to the network should get a fair chance of
transmitting their packets,this is generally done on a first come first serve basis.
• Adaptive Routing Algorithm(Dynamic)
1. Distance Vector Routing Algorithm
2. Link State Routing Algorithm
• Non Adaptive Routing Algorithm(Static)
i. Shortest Path Routing Algorithm
ii. Flooding
iii. Flow Based Routing Algorithm
• Hirarchical Routing Algorithm
• Broadcast Routing Algorithm
• Multicast Routing Algorithm
(DVR)
Distance Vector Routing(DVR): protocol requires that a router inform its neighbors of
topology changes periodically. Historically known as the old ARPANET routing
algorithm (or known as Bellman-Ford algorithm).
Bellman Ford Basics :- Each router maintains a Distance Vector table containing the
distance between itself and ALL possible destination nodes. Distances, based on a
chosen metric, are computed using information from the neighbors’ distance vectors.
Information kept by DV router -
i. Each router has an ID
ii. Associated with each link connected to a router, there is a link cost (static or
dynamic).
iii. Intermediate hops
Distance Vector Table Initialization -
a. Distance to itself = 0
b. Distance to ALL other routers = infinity number.
Defines distance at each node:
dx(y)=cost of path x to y
[x=source,y=destination]
Update distance based on neighbours:
dx(y)=min{cost(x,v)+dv(y)}
[x=source,y=destination,v=intermediate node]
EXAMPLE – CONSIDER 3-ROUTERS X, Y AND Z AS
SHOWN IN FIGURE. EACH ROUTER HAVE THEIR
ROUTING TABLE. EVERY ROUTING TABLE WILL
CONTAIN DISTANCE TO THE DESTINATION NODES.
Consider router X , X will share it routing table to neighbors and neighbors will share it routing table to it to X and distance from node X to
destination will be calculated using bellmen- ford equation.
Dx(y) = min { C(x,v) + Dv(y)} for each node y ∈ N
As we can see that distance will be less going from X to Z when Y is intermediate node(hop) so it will be update in routing table X.
SIMILARLY FOR Z ALSO –
FINALLY THE ROUTING TABLE FOR ALL –
• Advantages of Distance Vector routing –
• It is simpler to configure and maintain than link state routing.
• Disadvantages of Distance Vector routing –
• It is slower to converge than link state.
• For larger networks, distance vector routing results in larger routing tables than link
state since each router must know about all other routers. This can also lead to
congestion on WAN links.
• Note – Distance Vector routing uses UDP(User datagram protocol) for
transportation.
• Link state routing is a technique in which each router shares the knowledge of its
neighborhood with every other router in the internetwork
• The three keys to understand the Link State Routing algorithm:
• Knowledge about the neighborhood: Instead of sending its routing table, a
router sends the information about its neighborhood only.
• Flooding: Each router sends the information to every other router on the
internetwork except its neighbors. This process is known as Flooding. Every router
that receives the packet sends the copies to all its neighbors. Finally, each and
every router receives a copy of the same information.
• Information sharing: A router sends the information to every other router only
when the change occurs in the information.
Reliable Flooding
Route Calculation
• Each node uses Dijkstra's algorithm on the graph to calculate the
optimal routes to all nodes.
LET'S UNDERSTAND THROUGH AN EXAMPLE:
The first step is an initialization step. The currently known least cost path
from A to its directly attached neighbors, B, C, D are 2,5,1 respectively.
The cost from A to B is set to 2, from A to D is set to 1 and from A to C is
set to 5. The cost from A to E and F are set to infinity as they are not
directly linked to A.
Step N D(B)
,P(B)
D(C)
,P(C)
D(D)
,P(D)
D(E)
,P(E)
D(F),
P(F)
1 A 2,A 5,A 1,A ∞ ∞
• In the previous table, we observe that vertex D contains the least cost path in step 1. Therefore, it is added in N. Now, we need to determine a least-cost path through D vertex.
• a) Calculating shortest path from A to B
1. v = B, w = D
2. D(B) = min( D(B) , D(D) + c(D,B) )
3. = min( 2, 1+2)>
4. = min( 2, 3)
5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2.
• b) Calculating shortest path from A to C
1. v = C, w = D
2. D(B) = min( D(C) , D(D) + c(D,C) )
3. = min( 5, 1+3)
4. = min( 5, 4)
5. The minimum value is 4. Therefore, the currently shortest path from A to C is 4.</p>
• c) Calculating shortest path from A to E
1. v = E, w = D
2. D(B) = min( D(E) , D(D) + c(D,E) )
3. = min( ∞, 1+1)
4. = min(∞, 2)
5. The minimum value is 2. Therefore, the currently shortest path from A to E is 2.
Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,D ∞
• In the above table, we observe that both E and B have the least cost path in step 2. Let's consider the E vertex. Now, we determine the least cost path of remaining vertices
through E. a) Calculating the shortest path from A to B.
1. v = B, w = E
2. D(B) = min( D(B) , D(E) + c(E,B) )
3. = min( 2 , 2+ ∞ )
4. = min( 2, ∞)
5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2.
• b) Calculating the shortest path from A to C.
1. v = C, w = E
2. D(B) = min( D(C) , D(E) + c(E,C) )
3. = min( 4 , 2+1 )
4. = min( 4,3)
5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3.
• c) Calculating the shortest path from A to F.
1. v = F, w = E
2. D(B) = min( D(F) , D(E) + c(E,F) )
3. = min( ∞ , 2+2 )
4. = min(∞ ,4)
5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.
Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,D ∞
3 ADE 2,A 3,E 4,E
• In the above table, we observe that B vertex has the least cost path in step 3. Therefore, it is added in N. Now, we determine the least cost path of remaina) Calculating the
shortest path from A to C.
1. v = C, w = B
2. D(B) = min( D(C) , D(B) + c(B,C) )
3. = min( 3 , 2+3 )
4. = min( 3,5)
5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3.
• b) Calculating the shortest path from A to F.
1. v = F, w = B
2. D(B) = min( D(F) , D(B) + c(B,F) )
3. = min( 4, ∞)
4. = min(4, ∞)
5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.
Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,D ∞
3 ADE 2,A 3,E 4,E
4 ADEB 3,E 4,E
In the below table, we observe that C vertex has the least cost path in step 4.
Therefore, it is added in N. Now, we determine the least cost path of remaining
vertices through C.
• a) Calculating the shortest path from
A to F.
1.v = F, w = C
2.D(B) = min( D(F) , D(C) + c(C,F) )
3. = min( 4, 3+5)
4. = min(4,8)
5.The minimum value is 4. Therefore, the c
urrently shortest path from A to F is 4.
Ste
p
N D(
B),
P(B
)
D(
C),
P(C
)
D(
D),
P(D
)
D(
E),
P(E
)
D(F
),P(
F)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,D ∞
3 AD
E
2,A 3,E 4,E
4 AD
EB
3,E 4,E
5 AD
EB
C
4,E
Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)
1 A 2,A 5,A 1,A ∞ ∞
2 AD 2,A 4,D 2,D ∞
3 ADE 2,A 3,E 4,E
4 ADEB 3,E 4,E
5 ADEBC 4,E
6 ADEBCF
•Link-state protocols use cost metrics to choose paths through the network. The cost metric reflects the capacity of the links on those paths.
•Each router has a complete and synchronized picture of the network. Therefore, it is very difficult for routing loops to occur.
•Routers use the latest information to make the best routing decisions.
•The link-state database sizes can be minimized with careful network design. This leads to smaller Dijkstra calculations and faster convergence..
•Link-state protocols support CIDR and VLSM.
The following are some disadvantages of link-state routing protocols:
•They require more memory and processor power than distance vector protocols. This makes it expensive to use for organizations with small budgets and legacy hardware.
•They require an administrator who understands the protocols well.
I. Geeksforgeeks
II. Javatpoint
III. Tutorial spoint
IV. Behrouz A.Fourouzan
routing algorithm

routing algorithm

  • 1.
  • 3.
    • Router • Propertiesof routing algorithm • Types of routing algorithm • Distance Vector Routing Algorithm • Advantages & Disadvantages of DVR • Link State Routing Algorithm • Advantages & Disadvantages of LSR
  • 4.
    • A routeris located at the gateway • It routes packets as they travel from one network to another network • The router is connected to at least two networks
  • 5.
    • Find path •Forward packet • Find alternative path • Forward packet • Repeat until power off
  • 7.
    Routing is theprocess of forwarding of a packet in a network so that it reaches its intended destination. • Correctness The routing should be done properly and correctly so that the packets may reach their proper destination • Simplicity The routing should be done in a simple manner • Robustness Once a major network becomes operative,it may be expected to run continouslyfor years without any failures.
  • 8.
    • Stability Therouting algorithms shoulb be stable under all possible circumstance • Fairness Every node connected to the network should get a fair chance of transmitting their packets,this is generally done on a first come first serve basis.
  • 9.
    • Adaptive RoutingAlgorithm(Dynamic) 1. Distance Vector Routing Algorithm 2. Link State Routing Algorithm • Non Adaptive Routing Algorithm(Static) i. Shortest Path Routing Algorithm ii. Flooding iii. Flow Based Routing Algorithm • Hirarchical Routing Algorithm • Broadcast Routing Algorithm • Multicast Routing Algorithm
  • 10.
    (DVR) Distance Vector Routing(DVR):protocol requires that a router inform its neighbors of topology changes periodically. Historically known as the old ARPANET routing algorithm (or known as Bellman-Ford algorithm). Bellman Ford Basics :- Each router maintains a Distance Vector table containing the distance between itself and ALL possible destination nodes. Distances, based on a chosen metric, are computed using information from the neighbors’ distance vectors. Information kept by DV router - i. Each router has an ID ii. Associated with each link connected to a router, there is a link cost (static or dynamic). iii. Intermediate hops Distance Vector Table Initialization - a. Distance to itself = 0 b. Distance to ALL other routers = infinity number.
  • 11.
    Defines distance ateach node: dx(y)=cost of path x to y [x=source,y=destination] Update distance based on neighbours: dx(y)=min{cost(x,v)+dv(y)} [x=source,y=destination,v=intermediate node]
  • 12.
    EXAMPLE – CONSIDER3-ROUTERS X, Y AND Z AS SHOWN IN FIGURE. EACH ROUTER HAVE THEIR ROUTING TABLE. EVERY ROUTING TABLE WILL CONTAIN DISTANCE TO THE DESTINATION NODES.
  • 13.
    Consider router X, X will share it routing table to neighbors and neighbors will share it routing table to it to X and distance from node X to destination will be calculated using bellmen- ford equation. Dx(y) = min { C(x,v) + Dv(y)} for each node y ∈ N As we can see that distance will be less going from X to Z when Y is intermediate node(hop) so it will be update in routing table X.
  • 14.
  • 15.
    FINALLY THE ROUTINGTABLE FOR ALL –
  • 16.
    • Advantages ofDistance Vector routing – • It is simpler to configure and maintain than link state routing. • Disadvantages of Distance Vector routing – • It is slower to converge than link state. • For larger networks, distance vector routing results in larger routing tables than link state since each router must know about all other routers. This can also lead to congestion on WAN links. • Note – Distance Vector routing uses UDP(User datagram protocol) for transportation.
  • 17.
    • Link staterouting is a technique in which each router shares the knowledge of its neighborhood with every other router in the internetwork • The three keys to understand the Link State Routing algorithm: • Knowledge about the neighborhood: Instead of sending its routing table, a router sends the information about its neighborhood only. • Flooding: Each router sends the information to every other router on the internetwork except its neighbors. This process is known as Flooding. Every router that receives the packet sends the copies to all its neighbors. Finally, each and every router receives a copy of the same information. • Information sharing: A router sends the information to every other router only when the change occurs in the information.
  • 18.
    Reliable Flooding Route Calculation •Each node uses Dijkstra's algorithm on the graph to calculate the optimal routes to all nodes.
  • 19.
  • 20.
    The first stepis an initialization step. The currently known least cost path from A to its directly attached neighbors, B, C, D are 2,5,1 respectively. The cost from A to B is set to 2, from A to D is set to 1 and from A to C is set to 5. The cost from A to E and F are set to infinity as they are not directly linked to A. Step N D(B) ,P(B) D(C) ,P(C) D(D) ,P(D) D(E) ,P(E) D(F), P(F) 1 A 2,A 5,A 1,A ∞ ∞
  • 21.
    • In theprevious table, we observe that vertex D contains the least cost path in step 1. Therefore, it is added in N. Now, we need to determine a least-cost path through D vertex. • a) Calculating shortest path from A to B 1. v = B, w = D 2. D(B) = min( D(B) , D(D) + c(D,B) ) 3. = min( 2, 1+2)> 4. = min( 2, 3) 5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2. • b) Calculating shortest path from A to C 1. v = C, w = D 2. D(B) = min( D(C) , D(D) + c(D,C) ) 3. = min( 5, 1+3) 4. = min( 5, 4) 5. The minimum value is 4. Therefore, the currently shortest path from A to C is 4.</p>
  • 22.
    • c) Calculatingshortest path from A to E 1. v = E, w = D 2. D(B) = min( D(E) , D(D) + c(D,E) ) 3. = min( ∞, 1+1) 4. = min(∞, 2) 5. The minimum value is 2. Therefore, the currently shortest path from A to E is 2. Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2,D ∞
  • 23.
    • In theabove table, we observe that both E and B have the least cost path in step 2. Let's consider the E vertex. Now, we determine the least cost path of remaining vertices through E. a) Calculating the shortest path from A to B. 1. v = B, w = E 2. D(B) = min( D(B) , D(E) + c(E,B) ) 3. = min( 2 , 2+ ∞ ) 4. = min( 2, ∞) 5. The minimum value is 2. Therefore, the currently shortest path from A to B is 2. • b) Calculating the shortest path from A to C. 1. v = C, w = E 2. D(B) = min( D(C) , D(E) + c(E,C) ) 3. = min( 4 , 2+1 ) 4. = min( 4,3) 5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3.
  • 24.
    • c) Calculatingthe shortest path from A to F. 1. v = F, w = E 2. D(B) = min( D(F) , D(E) + c(E,F) ) 3. = min( ∞ , 2+2 ) 4. = min(∞ ,4) 5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4. Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2,D ∞ 3 ADE 2,A 3,E 4,E
  • 25.
    • In theabove table, we observe that B vertex has the least cost path in step 3. Therefore, it is added in N. Now, we determine the least cost path of remaina) Calculating the shortest path from A to C. 1. v = C, w = B 2. D(B) = min( D(C) , D(B) + c(B,C) ) 3. = min( 3 , 2+3 ) 4. = min( 3,5) 5. The minimum value is 3. Therefore, the currently shortest path from A to C is 3. • b) Calculating the shortest path from A to F. 1. v = F, w = B 2. D(B) = min( D(F) , D(B) + c(B,F) ) 3. = min( 4, ∞) 4. = min(4, ∞) 5. The minimum value is 4. Therefore, the currently shortest path from A to F is 4.
  • 26.
    Step N D(B),P(B)D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2,D ∞ 3 ADE 2,A 3,E 4,E 4 ADEB 3,E 4,E In the below table, we observe that C vertex has the least cost path in step 4. Therefore, it is added in N. Now, we determine the least cost path of remaining vertices through C.
  • 27.
    • a) Calculatingthe shortest path from A to F. 1.v = F, w = C 2.D(B) = min( D(F) , D(C) + c(C,F) ) 3. = min( 4, 3+5) 4. = min(4,8) 5.The minimum value is 4. Therefore, the c urrently shortest path from A to F is 4. Ste p N D( B), P(B ) D( C), P(C ) D( D), P(D ) D( E), P(E ) D(F ),P( F) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2,D ∞ 3 AD E 2,A 3,E 4,E 4 AD EB 3,E 4,E 5 AD EB C 4,E
  • 28.
    Step N D(B),P(B)D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F) 1 A 2,A 5,A 1,A ∞ ∞ 2 AD 2,A 4,D 2,D ∞ 3 ADE 2,A 3,E 4,E 4 ADEB 3,E 4,E 5 ADEBC 4,E 6 ADEBCF
  • 29.
    •Link-state protocols usecost metrics to choose paths through the network. The cost metric reflects the capacity of the links on those paths. •Each router has a complete and synchronized picture of the network. Therefore, it is very difficult for routing loops to occur. •Routers use the latest information to make the best routing decisions. •The link-state database sizes can be minimized with careful network design. This leads to smaller Dijkstra calculations and faster convergence.. •Link-state protocols support CIDR and VLSM. The following are some disadvantages of link-state routing protocols: •They require more memory and processor power than distance vector protocols. This makes it expensive to use for organizations with small budgets and legacy hardware. •They require an administrator who understands the protocols well.
  • 30.
    I. Geeksforgeeks II. Javatpoint III.Tutorial spoint IV. Behrouz A.Fourouzan