Transcript Lesson 10

Routing
Lesson 10
NETS2150/2850
http://www.ug.cs.usyd.edu.au/~nets2150/
School of Information Technologies
1
Lesson Outline
• Know the characteristics of unicast routing
protocol
• Understand various ways of routing
—Routing Strategies
• Experiment with common routing algorithms
—Dijsktra’s Algorithm of OSPF
—Bellman-Ford Algorithm of RIP
2
Routing
Routing protocol
Goal: find “good” path thru
network from source to
destination.
Graph abstraction for
routing algorithms:
• graph nodes are routers
• graph edges are
physical links
— link cost/weight:
delay, $ cost or
congestion level
B
C
A
F
D
E
• “good” path:
— typically means minimum
cost path
3
Routing in Packet Switched
Network
• Routing protocol establish mutually consistent routing
tables in every router
• Characteristics of routing protocol:
— Stability
— Fairness
— Optimality
— Efficiency
— Correctness
— Simplicity
— Robustness
application
transport
network
data link 1. Send data
physical
Packet switching network
network
data link
physical
application
transport
2. Receive data network
data link
physical
4
Performance Criteria
• How to select “best” path?
• Used for selection of path
—Minimum hop
—Least cost
IP routing table
Destination
Gateway
Netmask
Iface
129.78.8.0
0.0.0.0
255.255.252.0
eth0
127.0.0.0
0.0.0.0
255.0.0.0
lo
0.0.0.0
129.78.11.254
0.0.0.0
eth0
5
Example Packet Switched
Network
Link cost
•Shortest path VS
•Least-cost path
6
Routing Strategies
•
•
•
•
Fixed
Flooding
Random
Adaptive
7
Fixed Routing
• Single permanent path for each source to
destination pair
• Path fixed, at least until a change in network
topology
8
Fixed Routing
Tables
Network Topology
9
Flooding
• Packet sent by node to every neighbour and the
neighbour sends to its neighbours
• Incoming packets retransmitted on every link
except incoming link
• Eventually a number of copies will arrive at
destination
• Each packet is uniquely numbered so duplicates
can be discarded
• To bound the flood, max hop count is included
in the packets
If (Packet’s hop count = = max_hop_count) discard!
10
Flooding
Example
11
Properties of Flooding
• All possible routes are tried
—Very robust
• At least one packet will have taken minimum
hop count or “best” route
• All nodes are visited
• The common approach used to distribute
routing information, like a node’s link costs to
neighbours
12
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
• Path is typically not “best” one
• Used in ‘hot potato routing’
— nodes have no buffer to store packets
— packets routed to any path of the lowest delay
13
Adaptive Routing
• Used by almost all packet switching networks
• Routing decisions change as conditions on the
network change
—Failure
—Congestion
• Requires info about network
• Decisions more complex
14
Adaptive Routing - Advantages
• Improved performance
• Aids congestion control by exercising
load balancing across different
alternative paths
• But, it is complex
—Reacting too quickly can cause
oscillation
—Too slowly, may not be relevant
15
Routing Algorithm classification
Global or decentralised information?
Global:
• all routers have complete topology, link cost info
• Known as “link state” algorithms
• E.g. Dijkstra’s Algorithm
Decentralised:
• router knows physically-connected neighbours, i.e link
costs to neighbours
• iterative process of computation, exchange of info with
neighbours
• Known as “distance vector” algorithms
• E.g. Bellman-Ford Algorithm
16
Routing Algorithms
• Given network of nodes connected by bidirectional links
• Each link has a cost in each direction and may
be different
• Cost of path between two nodes is sum of costs
of links traversed
• For each pair of nodes, find a path with the
least cost
17
Dijkstra’s Algorithm Definitions
• Find shortest paths from given source node to all other
nodes, by developing paths in order of increasing path
length
• N = set of nodes in the network
• s = source node
• T = set of nodes so far incorporated by the algorithm
• w(i, j) = link cost from node i to node j
— w(i, i) = 0
— w(i, j) =  if the two nodes are not directly connected
— w(i, j)  0 if the two nodes are directly connected
• L(n) = cost of least-cost path from node s to node n
18
Dijkstra’s Algorithm
• Step 1 [Initialization]
— T = {s} Set of nodes so far incorporated consists of only source
node
— L(n) = w(s, n) for n ≠ s
• Step 2 [Get Next Node]
— Find neighbouring node, x, not in T with least-cost path from s
— Incorporate node x into T
• Step 3 [Update Least-Cost Paths]
— L(n) = min[L(n), L(x) + w(x, n)] for all n  T
• Algorithm terminates when all nodes have been added
to T
19
Dijkstra’s Algorithm Notes
• At termination, value L(x) associated with each
node x is cost of least-cost path from s to x.
• One iteration of steps 2 and 3 adds one new
node to T
—Defines least cost path from s to that node
20
5
5
2
A
3
B
2
1
C
2
1
2
T = {A}
E
2
2
A
F
2
3
D
5
2
A
3
C
2
E
A
F
2
3
D
5
2
1
2
2
A
B
2
1
D
5
F
2
2
E
2
T = {A,D,B}
5
C
3
D
2
T = {A,D}
3
2
F
E
2
B
5
2
5
2
1
C
3
D
5
B
3
B
T = {A,D,B,E}
5
3
C
3
2
5
F
2
E
2
T = {A,D,B,E,C}
2
A
B
2
1
D
3
C
3
2
5
F
2
E
2
21
T = {A,D,B,E,C,F}
Results of Example
Dijkstra’s Algorithm
No
T
L(B) Path
L(C) Path
L(D) Path
1
{A}
2 A–B
5 A-C
1 A–D
2
{A,D}
2 A–B
4 A-D-C
1 A–D
3
{A,D,B}
2 A–B
4 A-D-C
4
{A,D,B,
E}
2 A–B
5
{A,D,B,
E,C}
6
{A,D,B,
E,C,F}
L(E) Path
L(F)
Path

-
3 A-D-E

-
1 A–D
3 A-D-E

-
4 A-D-C
1 A–D
3 A-D-E
5
A-D-E-F
2 A–B
4 A-D-C
1 A–D
3 A-D-E
5
A-D-E-F
2 A–B
4 A-D-C
1 A–D
3 A-D-E
5
A-D-E-F

-
22
Bellman-Ford Algorithm
Definitions
• Find shortest paths from given node considering at most
one hop away
• Then, find the shortest paths with a constraint of paths
of at most two hops. Then 3 hops, and so on…
• s = source node
• w(i, j) = link cost from node i to node j
— w(i, i) = 0
— w(i, j) =  if the two nodes are not directly connected
— w(i, j)  0 if the two nodes are directly connected
• h = maximum number of hops (links) in path
• Lh(n) = cost of least-cost path from s to n, at most h
hops away
23
Bellman-Ford Algorithm
• Step 1 [Initialization]
—Lh(s) = 0, for all h
—L0(n) = , for n  s
• Step 2 [Update]
—For each successive h > 0 and each node n:
• If Lh(n) >
min [L (j)
j h
+ w(j,n)] Then
– Lh+1(n)=minj[Lh(j)+w(j,n)]
• Connect n with predecessor node j that achieves
minimum cost
24
5
5
2
A
3
B
2
1
D
C
3
5
2
1
2
h=1
E
2
2
A
F
2
2
A
2
1
D
C
F
2
3
D
5
2
E
2
h=2
5
5
B
3
B
3
C
3
2
5
F
2
E
2
h=3
2
A
B
2
1
D
3
C
3
2
5
F
2
E
2
h=4
25
Results of Example
Bellman-Ford Algorithm
hop
Lh(B) Path
Lh(C) Path
Lh(D) Path
1
2 A–B
5
A-C
1 A–D
2
2 A–B
4 A-D-C
1 A–D
3
2 A–B
4 A-D-C
4
2 A–B
4 A-D-C
Lh(E) Path
Lh(F)
Path

-
3 A-D-E
10
A-C-F
1 A–D
3 A-D-E
5
A-D-E-F
1 A–D
3 A-D-E
5
A-D-E-F

-
26
Algorithms Comparison
• Results from two algorithms agree
• Information gathered
— Bellman-Ford
• Each node can maintain set of costs and paths for every other node
• Only exchange information with direct neighbours
• Can update costs and paths based on information from neighbours
and knowledge of link costs
• Used as part of the Routing Information Protocol (RIP)
— Dijkstra
•
•
•
•
Each node needs complete topology
Must know link costs of all links in network
Must exchange information with all other nodes
Used as part of Open Shortest Path First Protocol (OSPF)
27
OSPF Protocol
28
Example: ImageStream’s
TransPort™ router
Physical Spec:
• 533 MHz VIA C3 processor
• 128 MB SDRAM
• Runs on Linux
• Three onboard 10/100
Ethernet ports
• 1 or 2 T1/E1 ports
Software spec:
• PPP, Cisco HDLC & frame
relay
• ATM
• PPPoE & PPPoA
• Routing procotols:
— RIP, RIP II, OSPF, IS-IS &
BGP4
29
Summary
• Routing is the process of finding a path from a
source to every destination in the network
• Different routing strategies available
• Common adaptive routing:
—Dijsktra’s algorithm
—Bellman-Ford algorithm
• Read Stallings Section 12.2 and 12.3
• Next: Functions of internetwork layer protocol
30