Lecture 8 and 9
Lecture 8 and 9
Routing
Outlines of this Lecture
• Introduction about Routing
• Routing strategies
• Least cost path
Introduction
Define Routing
• In most situations, packets will require multiple hops
to make journey towards the destination station .
• Routing is finding the optimal path for packet
delivery from source to destination
• Routing is one of the most 5
v w
u z
x y
• Oscillations possible:
– e.g., support link cost equals amount of carried
traffic:
1
A 1+e A A A
2+e 0 0 2+e 2+e 0
D 0 0 B D 1+e 1 B D B D 1+e 1 B
0 0
0 e 0 0
C 0 1 1+e 0
1 C C C
1
e
given these costs, given these costs, given these costs,
initially find new routing…. find new routing…. find new routing….
resulting in new costs resulting in new costs resulting in new costs
Lecture 9
Outlines
• Distance vector algorithm
• Link State Routing
• Multicast Routing
Distance vector algorithm
Bellman-Ford example
5
3
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v w 5
2
u 2 1 z B-F equation says:
3
1 2 du(z) = min { c(u,v) + dv(z),
x y
1
dv(z) = min{c(v,w) + dw(z), c(u,x) + dx(z),
c(u,w) + dw(z) }
c(v,x)+ dx(z)} = min {2 + 5,
1 + 3,
{3+ 3, 2+3} = {6,5} 5 + 3} = 4
node achieving minimum is next
hop in shortest path, used in forwarding table
Distance vector algorithm
Let Dx = [Dx(y): y є N ] be node x’s distance vector,
which is the vector of cost estimates from x to all
other nodes, y, in N.
Each node x maintains the following routing info:
– cost to each directly attached neighbor v of x:
c(x,v)
– the distance vector containing the estimate of the
cost to all destinations, y, in N: Dx = [Dx(y): y є N
]
– the distance vector of each neighbor v of x: Dv =
[Dv(y): y є N ]
Distance vector algorithm cont….
• Key characteristics of Distance vector routing
– Knowledge about the entire network
– Routing only to neighbors
– Information sharing at regular interval
– Each node maintains a routing table having one
entry for each node with two other fields;
preferred next node and a cost estimate of the
distance, based one of the metrics
Distance vector algorithm cont.….
key idea:
• From time-to-time, each node sends its own distance
vector estimate to neighbors
• when x receives new DV estimate from neighbor, it
updates its own DV using B-F equation:
from
from
y ∞∞ ∞ y 2 0 1
z ∞∞ ∞ z 7 1 0
node y cost to
table x y z y
2 1
x ∞ ∞ ∞
x z
from
y 2 0 1 7
z ∞∞ ∞
node z cost to
table x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to cost to
table x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from
from
y ∞∞ ∞ y 2 0 1
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
node y cost to cost to cost to
table x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z
from
from
y 2 0 1 y 2 0 1 7
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
x ∞∞ ∞ x 0 2 7 x 0 2 3
from
from
y 2 0 1 y 2 0 1
from
y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
Distance vector: Example 2
Case 1: Good news: no frailer
• A comes up again
Only distances to A
B receives:
• Distance from A
• Distance 2 from C
New distance from B to A: 3 via C
40
Distance vector: Example 2 cont….
LOOP!!!
C still
• believes its distance to A is 2
• routes via B
B routes its packets for A via C
Homework
1. Compare Dijkstra ’ s algorithm and Bellman Foard
algorithm in terms of
a) Robustness: what happens if router malfunctions?
b) Speed of convergence: running time it takes to
converge
2. Based on the given figure find the
least cost path to send data from
node A to all other nodes
a) Using Dijkstra’s algorithm
b) Using Bellman Foard algorithm
c) Consider node C goes down and
repeat a and b
Link State Routing
Basic steps
• Identify the neighboring nodes
• Measure the delay or cost to each of its
neighbors
• Form a packet containing all the information
• Send the packet to all other nodes (flooding)
• Compute the shortest path to every other
node (Dijkstra’s algorithm)
Link State Routing cont.….
• Key characteristics
– Knowledge about the neighborhood
– Routing to all
– Information sharing at regular intervals
Link state versus Distance Vector
• Link state algorithms converge more quickly
and are somewhat less prone to routing loops
than distance vector algorithms
• Link-state algorithms require more CPU
power and memory than distance vector
algorithms. Link state algorithms, therefor,
can be more expensive to implement
• Link-state protocols are generally more
scalable than distance vector protocols
Multicast Routing
• Sending a packet to a selected group is known
a multicasting
• To do multicast routing each node computes a
spanning tree covering all other nodes in the
subnet
• When a packet is sent the first router examines
its spanning tree and prunes it, removing all
nodes that don’t lead to stations, who are
member of the group
Multicast Routing cont..
1 A G E 4
2 C D 5
3 B H F 6
Source Destination
Multicast Routing cont..
1 A G E 4
2 C D 5
3 B H F 6
Source Destination
Multicast Routing cont..
1 A G E 4
2 C D 5
3 B H F 6
Source Destination