0% found this document useful (0 votes)
21 views

Lecture 8 and 9

The document discusses routing strategies in packet switched networks. It introduces routing and its importance, and covers static routing, flooding routing, random routing and dynamic routing. It also discusses the Dijkstra's algorithm for finding the least-cost path between nodes.

Uploaded by

Abraham Gadissa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Lecture 8 and 9

The document discusses routing strategies in packet switched networks. It introduces routing and its importance, and covers static routing, flooding routing, random routing and dynamic routing. It also discusses the Dijkstra's algorithm for finding the least-cost path between nodes.

Uploaded by

Abraham Gadissa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Lecture 8

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

complex and crucial v 3 w


2 5
aspect of packet switched u 2 1 z
3
network design 1 2
x 1
y
Introduction cont.…
Desirable properties of routing
• The desirable properties of routing are
– Correctness and simplicity
– Robustness: ability of the network to deliver
packets via some route even in the face of
failures
– Stability: the algorithm should converge to
equilibrium fast in the face of changing
conditions in the network
– Fairness and optimality
– Efficiency: minimum overhead
Introduction cont.…
Why Does Routing Matter?
• Routing provides connectivity!
– Without routing, the network doesn’t function
• Routing finds “good” paths
– Propagation delay, throughput, packet loss
• Routing allows network to tolerate failures
– Limits packet loss during disruptions
• Routing can also provide “Traffic Engineering”
– Balance traffic over the routers and links
– Avoid congestion by directing traffic to lightly-
loaded links
Introduction cont.…
Design parameters
• Performance criteria: number of hops, cost,
delay, throughput
• Decision time: per packet (datagram), per
session (virtual-circuit)
• Decision place: each node(distributed), central
node (centralized), originated node (source)
• Network information source: none, local,
adjacent node, nodes along route, all nodes
• Network information update time:
continuous, periodic, major load changes,
topology change
Introduction cont.…
Routing strategies
• Fixed/static routing
• Flooding routing
• Random Routing
• Adaptive/Dynamic routing
Static (Fixed) routing
• A route is selected for each source –
destination pair of nodes in the
network
• The routes are fixed (Does not change
with time), they may only change if there
is a change in the topology of the
network.
• routes change slowly over time
Static (Fixed) routing cont.…
How fixed routing may be implemented?
Example:
• A central routing matrix is created based on least –
cost path, which is stored at a network control center
• The matrix shows, for each source –destination pair
of nodes, the identity of the next node on the route
Static (Fixed) routing cont.…
• From the main routing matrix, routing
tables to be sued by each individual node
can be developed
Static (Fixed) routing cont.…
• Advantage of Static routing
– Simple
– Works well in a reliable network with stable
load in a reliable network
– Same for virtual –circuit and datagram
• Disadvantage of Static routing
– Lack of flexibility
– Does not react to failure or network congestion
– Not very reliable approach, if central node fail
all collapse
Flood routing
• Requires no network information
whatsoever
• Every incoming packet to a node is sent
out on every outgoing line except the one
it arrived on
Flood routing cont.…
• Characteristics:
– All passible routes between source and
destination are tried.
– A packet will always get through if a path
exists
– As all routes are tried, at least one packet
will pass through the shortest route
– All nodes, directly or indirectly connected,
are visited
Flooding Example
Flood routing cont…
• Limitation of flooding routing
– Flooding generates vast number of
duplication packets
– Suitable damping mechanism must be used
Flood routing cont.…
Selective flooding
• A variation which is slightly more
practical is selective flooding
• The routers do not send every incoming
packet out on every line, only on those
lines that go in approximately in the
direction of destination
Flood routing cont.…
How to limit duplication in flooding?
• Hop-count: a hop counter may be contained in
the packet header, which is decremented at each
hop, with the packet being discarded when the
counter becomes zero
• The sender initializes the hope counter. If no
estimate is known, it is set to the full diameter of
the subnet
• Keep track of packets which are responsible for
flooding using a sequence number. Avoid
sending them out a second time
Flood routing cont.…
Application Areas of flooding
• Flooding is highly robust, and could be used to
send emergency messages (eg. Military
applications)
• May be used to initially set up the route in a
virtual circuit
• Flooding always chooses the shortest path, since it
explores every possible path in parallel
• Can be useful for the dissemination of important
information to all nodes (e.g. routing information )
Random Routing
• Node selects one outgoing path for
retransmission of incoming packet
• Selection can be random or round robin
• Can select outgoing path based on
probability calculation
• No network info needed
• Route is typically not least cost nor
minimum hop
Adaptive or Dynamic routing
• Routers change more quickly
– periodic update
– in response to link cost changes
• The purpose of dynamic routing protocols
includes:
– Discovery of remote networks
– Maintaining up-to-date routing information
– Choosing the best path to destination
networks
– Ability to find a new best path if the current
path is no longer available
Adaptive or Dynamic routing cont.…
• Advantages of dynamic routing include:
– Automatically share information about remote networks
– Determine the best path to each network and add this
information to their routing tables
– Compared to static routing, dynamic routing protocols
require less administrative overhead
– Help the network administrator manage the time-
consuming process of configuring and maintaining static
routes

• Disadvantages of dynamic routing include:


– Part of a router’s resources are dedicated for protocol
operation, including CPU time and network link bandwidth
– Times when static routing is more appropriate
Adaptive or Dynamic routing cont.…
Dynamic Routing Protocol Operation
In general, the operations of a dynamic routing protocol
can be described as follows:
1. The router sends and receives routing messages on
its interfaces.
2. The router shares routing messages and routing
information with other routers that are using the
same routing protocol.
3. Routers exchange routing information to learn about
remote networks.
4. When a router detects a topology change the routing
protocol can advertise this change to other routers
Drawback of Dynamic Routing
• Routing decision is more complex
– more processing burden on the switching modes
• Depends on status information that is collected at one
place but used at another
– Traffic overhead increase
• It may react too quickly to changing network state,
therefore by producing congestion producing
oscillation
• Despite the drawbacks, adaptive routing is widely
used
– Improves performance
– Can aid in congestion control
Least-cost path
• A cost is associated with each link
• The simplest criterion is to choose the
minimum-hop route through the network.
• Easily measured criterion
• A generalization is least-cost routing
• For any pair of attached stations, the least cost
route through the network is looked for
• For either case, several well-known algorithms
exist to obtain the optimum path
– Dijkstra’s algorithm
– Bellman-Ford algorithm
Dijkstra’s Algorithm
• It find shortest paths from a given source
node to all other nodes in order of
increasing path length
• The algorithm converges under static
conditions of topology and link cost
• There are basic steps:
– Initialization: M = (s), Dn = dsn for n = s
– Find neighboring nodes not in M that has least-
cost path from s and including in M
– Update least cost paths
Dijkstra’s Algorithm cont…
1 Initialization:
2 M = {u}
3 for all nodes v
4 if v adjacent to u {
5 D(v) = c(u,v)
6 else D(v) = ∞
7
8 Loop
9 find w not in M with the smallest D(w)
10 add w to M
11 update D(v) for all v adjacent to w and not in S:
12 D(v) = min{D(v), D(w) + c(w,v)}
13 until all nodes in M
Dijkstra’s algorithm: example
Step M D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 {u} 2,u 5,u 1,u ∞ ∞
1 {u, x} 2,u 4,x 2,x ∞
2 {u, x, y} 2,u 3,y 4,y
3 {u, x, y, v} 3,y 4,y
4 {u, x, y, v, w} 4,y
5 {u, x, y, v, w z}
Dijkstra’s algorithm: example
Resulting shortest-path tree from u:

v w
u z
x y

Resulting forwarding table in u:


Resulting forwarding table in X:
Destination link
Destination link
v (u,v)
u (x, u)
x (u,x)
v (x, v)
y (u,x)
y (x, y)
w (u,x)
w (x, W)
z (u,x)
z (x, y)
Dijkstra’s algorithm, discussion
• Algorithm complexity: n nodes
– Each iteration: need to check all nodes, w, not in M
– n(n+1)/2 comparisons: O(n2)
– More efficient implementations possible: O(nlogn)

• 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:

Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N

(if DV to any dest has changed, notify neighbors)

 under minor, natural conditions, the estimate Dx(y)


converge to the actual least cost dx(y)
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
table x y z x y z
x 0 2 7 x 0 2 3

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

node z cost to cost to cost to


table x y z x y z x y z

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

Faster not possible!!!


Distance vector: Example 2 cont.…

Case 2: Bad news:


• A goes down

B receives:
• Distance  from A
• Distance 2 from C
New distance from B to A: 3 via C

40
Distance vector: Example 2 cont….

Bad news: continue


• A goes down

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

You might also like