Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
27 views

Lecture05 Routing

The document summarizes a lecture on routing techniques in computer networks. It discusses packet routing and forwarding, different routing techniques including naive flooding, distance vector routing using the distributed Bellman-Ford algorithm, and link state routing using Dijkstra's shortest path first algorithm. Examples are provided to illustrate how these routing techniques work to determine the optimal path between nodes in a network.

Uploaded by

poppy seess
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)
27 views

Lecture05 Routing

The document summarizes a lecture on routing techniques in computer networks. It discusses packet routing and forwarding, different routing techniques including naive flooding, distance vector routing using the distributed Bellman-Ford algorithm, and link state routing using Dijkstra's shortest path first algorithm. Examples are provided to illustrate how these routing techniques work to determine the optimal path between nodes in a network.

Uploaded by

poppy seess
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/ 28

CSC 458/2209 – Computer Networks

Lecture 5: Routing
Professor Peter Marbach
Department of Computer Science
University of Toronto
Packet Routing and Forwarding
Forwarding IP datagrams
Class-based vs. CIDR

Routing Techniques
Naïve: Flooding
Distance vector: Distributed Bellman Ford Algorithm
Link state: Dijkstra’s Shortest Path First-based
Algorithm

Routing is a very complex subject, and has many aspects.


Here,
CSC 458/CSC 2209 – Computer we will concentrate on
Networks the
University basics.
of Toronto – Fall 2019 2
The Problem
“A” “B”

RR22

RR11 RR44

How does R1 choose a


next-hop on the path RR33
towards host B?

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 3


What is Routing?
A famous quotation from RFC 791
 “A name indicates what we seek.
An address indicates where it is.
A route indicates how we get there.”
-- Jon Postel

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 4


Forwarding vs. Routing
Forwarding: data plane
Directing a data packet to an outgoing link
Individual router using a forwarding table
Routing: control plane
Computing paths the packets will follow
Routers talking amongst themselves
Individual router creating a forwarding table

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 5


Why Does Routing Matter?
End-to-end performance
Quality of the path affects user performance
Propagation delay, throughput, and packet loss
Use of network resources
Balance of the traffic over the routers and links
Avoiding congestion by directing traffic to lightly-
loaded links
Transient disruptions during changes
Failures, maintenance, and load balancing
Limiting packet loss and delay during changes

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 6


Example Network
Objective: Determine the route from A to B that minimizes the
path cost.
Examples of link cost:
A Distance, data rate, price,
congestion/delay, …

1 1 4
R1 R2 R4 R6

2 2 3
2
R7 3
R5 2
R3 4 B
R8

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 7


Example Network
In this simple case, solution is clear from inspection
A

1 1 4
R1 R2 R4 R6

2 2 3
2
R7 3
R5 2
R3 4 B
R8

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 8


What about this Network...!?

Learn more at
http://www.lumeta.com

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 9


Technique 1: Naïve Approach
Flood! -- Routers forward packets to all ports
except the ingress port.

R1

Advantages:
 Simple
 Every destination in the network is reachable.
Disadvantages:
 Some routers receive a packet multiple times.
 Packets can go round in loops forever.
 Inefficient.

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 10


Lowest Cost Routes
Objective: Find the lowest cost route from each of
(R1, …, R7) to R8.

1 1 4
R1 R2 R4 R6

2 2 3
2
R7 3
R5 2
R3 4
R8

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 11


A Spanning Tree
1 1 4
R1 R2 R4 R6
3
2 2
2
R7
R5 2 3

4
R3 R8

 The solution is a spanning tree with R8 as the root of the tree.


 Tree: There are no loops.
 Spanning: All nodes included.
 We’ll see two algorithms that build spanning trees automatically:
 The distributed Bellman-Ford algorithm
 Dijkstra’s shortest path first algorithm

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 12


Technique 2: Distance Vector
Distributed Bellman-Ford Algorithm
Define distances at each node x
 dx(y) = cost of least-cost path from x to y
Update distances based on neighbors
 dx(y) = min {c(x,v) + dv(y)} over all neighbors v

v 2 y
3 1
1
u
x 4 z
2 1
5 t du(z) = min{c(u,v) + dv(z),
w 4 3
s c(u,w) + dw(z)}

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 13


Distance Vector Algorithm
c(x,v) = cost for direct link from x to v
Node x maintains costs of direct links c(x,v)
Dx(y) = estimate of least cost from x to y
Node x maintains distance vector Dx = [Dx(y): y є N ]
Node x maintains its neighbors’ distance vectors
For each neighbor v, x maintains Dv = [Dv(y): y є N ]

Each node v periodically sends Dv to its neighbors


And neighbors update their own distance vectors
Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N N
Over time, the distance vector Dx

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 14


Distance Vector Algorithm
Iterative, asynchronous:
each local iteration caused
Each node:
by:
Local link cost change
wait for (change in local link cost
Distance vector update or message from neighbor)
message from neighbor
Distributed:
recompute estimates
Each node notifies
neighbors only when its
DV changes if DV to any destination has
changed, notify neighbors
Neighbors then notify
their neighbors if
necessary
CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 15
Distance Vector Example: Step 1
Optimum 1-hop paths
Table for A Table for B
Dst Cst Hop Dst Cst Hop
E 3 C
A 0 A A 4 A 1

B 4 B B 0 B F 1
2
C  – C  – 6
D  – D 3 D 1
3 D
E 2 E E  – A 4
F 6 F F 1 F B

Table for C Table for D Table for E Table for F


Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A  – A  – A 2 A A 6 A
B  – B 3 B B  – B 1 B
C 0 C C 1 C C  – C 1 C
D 1 D D 0 D D  – D  –
E  – E  – E 0 E E 3 E
F
CSC 458/CSC 1 – Computer
2209 F F
Networks  – F 3 F F of Toronto
University 0 –FFall 2019 16
Distance Vector Example: Step 2
Optimum 2-hop paths
Table for A Table for B
Dst Cst Hop Dst Cst Hop
A 0 A A 4 A E 3 C
1
B 4 B B 0 B
F 1
C 7 F C 2 F 2
D 7 B D 3 D 6
1
E 2 E E 4 F 3 D
F 5 E F 1 F A 4
B

Table for C Table for D Table for E Table for F


Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A 7 F A 7 B A 2 A A 5 B
B 2 F B 3 B B 4 F B 1 B
C 0 C C 1 C C 4 F C 1 C
D 1 D D 0 D D  – D 2 C
E 4 F E  – E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F
CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 17
Distance Vector Example: Step 3
Optimum 3-hop paths

Table for A Table for B


Dst Cst Hop Dst Cst Hop
A 0 A A 4 A E 3 C
1
B 4 B B 0 B
F 1
C 6 E C 2 F 2
D 7 B D 3 D 6
1
E 2 E E 4 F 3 D
F 5 E F 1 F A 4
B

Table for C Table for D Table for E Table for F


Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A 6 F A 7 B A 2 A A 5 B
B 2 F B 3 B B 4 F B 1 B
C 0 C C 1 C C 4 F C 1 C
D 1 D D 0 D D 5 F D 2 C
E 4 F E 5 C E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F
CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 18
Bellman-Ford Algorithm
Questions:
How long can the algorithm take to run?
How do we know that the algorithm always
converges?
What happens when link costs change, or when
routers/links fail?

Topology changes make life hard for the Bellman-


Ford algorithm…

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 19


A Problem with Bellman-Ford
Bad news travels slowly

1 1 1
R1 R2 R3 R4

Consider the calculation of distances to R4:


Time R1 R2 R3
0 3,R2 2,R3 1, R4 R3 R4 fails
1 3,R2 2,R3 3,R2
2 3,R2 4,R3 3,R2
3 5,R2 4,R3 5,R2
… …
“Counting to…
infinity” …

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 20


Counting to Infinity Problem – Solutions
Set infinity = “some small integer” (e.g. 16). Stop
when count = 16.
Split Horizon: Because R2 received lowest cost path
from R3, it does not advertise cost to R3
Split-horizon with poison reverse: R2 advertises
infinity to R3
There are many problems with (and fixes for) the
Bellman-Ford algorithm.

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 21


Technique 3: Link State
Dijkstra’s Shortest Path First Algorithm

Routers send out update messages whenever the state of an


incident link changes.
Called “Link State Updates”

Based on all link state updates received each router


calculates lowest cost path to all others, starting from itself.
Use Dijkstra’s single-source shortest path algorithm
Assume all updates are consistent

At each step of the algorithm, router adds the next shortest
(i.e. lowest-cost) path to the tree.

Finds spanning tree rooted at the router.


CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 22
Dijsktra’s Algorithm
1 Initialization:
2 S = {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 S with the smallest D(w)
10 add w to S
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 S

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 23


Dijkstra’s Algorithm Example
Find Routes for the Red (Leftmost) Node

2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3

2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3
CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 24
Dijkstra’s Algorithm Example
2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3

2 2
3 1 3 1
1 1
4 4
2 1 2 1
5 5
4 3 4 3
CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 25
Shortest-Path Tree

Shortest-path tree from u Forwarding table at u


v 2 y
link
3 1
1
u
x 4 z
v (u,v)
2 1 w (u,w)
5 t x (u,w)
w 4 3
s y (u,v)
z (u,v)
s (u,w)
t (u,w)
CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 26
Reliable Flooding of LSP
The Link State Packet:
The ID of the router that created the LSP
List of directly connected neighbors, and cost
Sequence number
TTL

Reliable Flooding
Resend LSP over all links other than incident link, if the
sequence number is newer. Otherwise drop it.

Link State Detection:


Link layer failure
Loss of “hello” packets

CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 27


Comparison of LS and DV algorithms
Message complexity Robustness: what happens if
LS: with n nodes, E links, O(nE) router malfunctions?
messages sent LS:
DV: exchange between Node can advertise
neighbors only incorrect link cost
Convergence time varies Each node computes only
its own table
DV:
Speed of Convergence DV node can advertise
LS: O(n2) algorithm requires incorrect path cost
O(nE) messages Each node’s table used by
DV: convergence time others (error propagates)
varies
May be routing loops
Count-to-infinity problem
CSC 458/CSC 2209 – Computer Networks University of Toronto – Fall 2019 28

You might also like