Chapter 2 - Introduction To Routing - Part 2
Chapter 2 - Introduction To Routing - Part 2
Network Layer:
Control Plane
A note on the use of these PowerPoint slides:
We’re making these slides freely available to all (faculty, students,
readers). They’re in PowerPoint form so you see the animations; and
can add, modify, and delete slides (including this one) and slide content
to suit your needs. They obviously represent a lot of work on our part.
In return for use, we only ask the following:
If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
If you post any slides on a www site, that you note that they are
adapted from (or perhaps identical to) our slides, and note our
copyright of this material.
Computer Networking: A
For a revision history, see the slide note for this page.
Top-Down Approach
Thanks and enjoy! JFK/KWR 8th edition
Jim Kurose, Keith Ross
All material copyright 1996-2020
J.F Kurose and K.W. Ross, All Rights Reserved Pearson, 2020
NET-351 Chapter 2: Introduction to
Routing
Goal: Understand how data packets are
routed in an IP network
Roadmap:
• Introduction
• Terminology
• Routing protocols
• Classification • Intra-ISP routing: OSPF
• Static vs. dynamic • Routing among ISPs: BGP
• Global vs. decentralized
• Hierarchical
• Algorithms’ execution / filling routing table Network Layer: 5-2
Introduction: Network-layer functions
forwarding: move packets from router’s
input to appropriate router output data plane
routing: determine route taken by
packets from source to destination
control plane
Routing
Algorithm
control
plane
data
plane
values in arriving
packet header
0111 1
2
3
Organization Z
4c
networks
4a
3c 4b X
3a AS4
3b
2c
AS3 1c 2a
destination
Organization Y networks
networks 1a 2b
1b
1d AS2
AS1
Terminology: Routing vs. forwarding
Analogy: Routing: determines source-
Routing: process of planning trip destination route taken by packets
from source to destination Use routing algorithms to determines
Forwarding: process of getting end-end-path through network
network-wide process
through single interchange
Forwarding: moves
packets from router’s
input to appropriate
router output
use forwarding table to
determine local
forwarding at this
router
router-local action
Terminology: routing table & next hop
A routing table is a list of the possible networks that can be
used to route the data packets.
• Each routing table entry describes a route to reach a specific network
(set of networks)
• Alternate data paths (or alternate routes) are usually provided so that
a new route can be selected and data delivery maintained even if a
network route is down.
• When a router receives a packet, it examines the destination IP
address of the packet and selects the next hop using routing table
Dynamic:
“link state” algorithms
routes are calculated Decentralized: (Analogy: Street signs)
dynamically. They change router knows physically-connected
more quickly neighbors, link costs to neighbors
periodic update
iterative process of computation,
in response to events (e.g.
exchange of info with neighbors
link cost change, topology
change) “distance vector” algorithms
Static Routing
A static route is a data traffic route that has been manually
entered into either a router’s routing table or computer’s
routing table.
B1 C1 D1
B2 C2 12
D
Example
1) LAN A default gateway?
• Answer: 10.10.20.250
PC A1 MAC A1 2-15
Destination network Next hop
0.0.0.0 10.10.200.2
3)
Usage limited to
1. Small networks
2. Stub networks
3. Special/specific configurations
o e.g. gateway of last resort, route to a given network, back up route/floating route)
Routing protocols mobile network
national or global ISP
Routing protocol goal: determine “good”
paths (equivalently, routes), from sending
hosts to receiving host, through network of application
transport
network
routers link
physical
congested”
application
routing: a “top-10” networking challenge! transport
network
enterprise link
network physical
Delay – the time it takes for a data packet to travel from a source to
destination
Load - having to do with the network activity on a link or router.
Reliability – a measure of the reliability of the link typically in terms of the
amount of errors.
Cost – this is a value typically assigned by the network administrator that
takes into account bandwidth and expense.
Routing algorithm classification
global: all routers have complete
topology, link cost info
• “link state” algorithms
How fast
dynamic: routes change
do routes static: routes change more quickly
change? slowly over time • periodic updates or in
response to link cost
changes
decentralized: iterative process of
computation, exchange of info with neighbors
• routers initially only know link costs to
attached neighbors
• “distance vector” algorithms
global or decentralized information? Network Layer: 5-21
Dijkstra’s link-state routing algorithm
centralized: network topology, link notation
costs known to all nodes
• accomplished via “link state
cx,y: direct link cost from node
broadcast” x to y; = ∞ if not direct
neighbors
• all nodes have same info
D(v): current estimate of cost
computes least cost paths from one of least-cost-path from source
node (“source”) to all other nodes to destination v
• gives forwarding table for that node p(v): predecessor node along
path from source to v
iterative: after k iterations, know
least cost path to k destinations N': set of nodes whose least-
cost-path definitively known
Example
(a) Given network (b) The link state packets for this network
Dijkstra’s link-state routing algorithm
1 Initialization:
2 N' = {u} /* compute least cost path from u to all other nodes */
3 for all nodes v
4 if v adjacent to u /* u initially knows direct-path-cost only to direct neighbors */
5 then D(v) = cu,v /* but may not be minimum cost! */
6 else D(v) = ∞
7
8 Loop
9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min ( D(v), D(w) + cw,v )
13 /* new least-path-cost to v is either old least-cost-path to v or known
14 least-cost-path to w plus direct-cost from w to v */
15 until all nodes in N'
Network Layer: 5-25
Dijkstra’s algorithm: an example
v w x y z
Step N' 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 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz
Initialization (step 0): For all a: if a adjacent to then D(a) = cu,a
5
3 find a not in N' such that D(a) is a minimum
v w 5 add a to N'
2
u 2 1 z update D(b) for all b adjacent to a and not in N' :
3 D(b) = min ( D(b), D(a) + ca,b )
1 2
x 1
y
5 uwxvyz v
notes:
construct least-cost-path tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
Network Layer: 5-28
Exercise Use Dijkstra algorithm to find the best path
from home to each of the destinations (fill a trips
[routing] table, showing for each destination the distance
and next hop)
Garden
12 Domino’s Pizza
School 2
7 1
2
Home 1 5
1 Pharmacy
3 9 2
3
Mosque 10
Cinema
2-29
Dijkstra’s algorithm: discussion
algorithm complexity: n nodes
each of n iteration: need to check all nodes, w, not in N
n(n+1)/2 comparisons: O(n2) complexity
more efficient implementations possible: O(nlogn)
message complexity:
each router must broadcast its link state information to other n routers
efficient (and interesting!) broadcast algorithms: O(n) link crossings to disseminate a
broadcast message from one source
each router’s message crosses O(n) links: overall message complexity: O(n2)
a 2+e
a 0
a 2+e a
1 1+e 0 2+e 0
d b d 1+e 1 b d 0 0 b d 1+e 1 b
0 0
e 1 0 1
1 0
c 0 1 1
c 1+e 1 1 0 0 1
c 1 c
e e e
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
DV Distance Vector
Distance: Cost
Vector: Direction to neighbor (Next Hop)
from
y ∞∞ ∞ y 2 0 1
from
z ∞∞ ∞
cost to
Dz() x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time Network Layer: 5-39
Distance vector: Example 2 |(cont’d)
cost to cost to cost to
Dx() x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from
y ∞∞ ∞ y 2 0 1
from
y 2 0 1
from
z ∞∞ ∞ z 7 1 0 z 3 1 0
from
y 2 0 1
from
z ∞∞ ∞ z 7 1 0 z 3 1 0
x ∞∞ ∞ x 0 2 7 x 0 2 3
from
y 2 0 1 y 2 0 1
from
from
y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time Network Layer: 5-40
Distance vector: Example 3
DV in a:
Da(a)=0
Da(b) = 8
Da(c) = ∞ a b c
8 1
Da(d) = 1
t=0 Da(e) = ∞
Da(f) = ∞ 1 1
Da(g) = ∞
All nodes have
Da(h) = ∞
distance estimates
Da(i) = ∞ A few asymmetries:
to nearest d e f missing link
neighbors (only) 1 1
larger cost
All nodes send
their local
distance vector to 1 1 1
their neighbors
g h i
1 1
a b c
8 1
t=1 1 1
All nodes:
receive distance
vectors from
neighbors d e f
compute their new 1 1
local distance
vector
send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
a
compute compute
b compute
c
8 1
t=1 1 1
All nodes:
receive distance
vectors from
neighbors d
compute e
compute compute
f
compute their new 1 1
local distance
vector
send their new 1 1 1
local distance
vector to neighbors
g
compute h
compute i
compute
1 1
a b c
8 1
t=1 1 1
All nodes:
receive distance
vectors from
neighbors d e f
compute their new 1 1
local distance
vector
send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
a b c
8 1
t=2 1 1
All nodes:
receive distance
vectors from
neighbors d e f
compute their new 1 1
local distance
vector
send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
compute
a compute
b compute
c
2 1
t=2 1 1
All nodes:
receive distance
vectors from
neighbors d
compute compute
e compute
f
compute their new 1 1
local distance
vector
send their new 1 1 1
local distance
vector to neighbors
g
compute compute
h compute
i
8 1
a b c
8 1
t=2 1 1
All nodes:
receive distance
vectors from
neighbors d e f
compute their new 1 1
local distance
vector
send their new 1 1 1
local distance
vector to neighbors
g h i
1 1
…. and so on
d b(a}} = 1 + 8 = 9
Dc(a) = min{cc,b+D e f
DV in c:
Dc(b) = min{cc,b+Db(b)} = 1 + 0 = 1
Dc(a) = 9
Dc(d) = min{cc,b+Db(d)} = 1+ ∞ = ∞ Dc(b) = 1
Dc(e) = min{cc,b+Db(e)} = 1 + 1 = 2 Dc(c) = 0
Dc(f) = min{cc,b+Db(f)} = 1+ ∞ = ∞ Dc(d) = 2
Dc(g) = min{cc,b+Db(g)} = 1+ ∞ = ∞ Dc(e) = ∞ * Check out the online interactive
Dc(f) = ∞ exercises for more examples:
g b(h)} = 1+ ∞ = ∞
Dc(h) = min{cbc,b+D h i http://gaia.cs.umass.edu/kurose_ross/interactive/
Dc(g) = ∞
Dc(i) = min{cc,b+Db(i)} = 1+ ∞ = ∞
Dc(h) = ∞
Network Layer: 5-52
Dc(i) = ∞
Distance vector example: computation DV in b:
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞
Db(d) = ∞ Db(h) = ∞ DV in e:
DV in d:
Db(e) = 1 Db(i) = ∞ De(a) = ∞
Dc(a) = 1
De(b) = 1
Dc(b) = ∞ a b c De(c) = ∞
Dc(c) = ∞ 8 1
De(d) = 1
Dc(d) = 0
t=1 Dc(e) = 1
1
Q: what is new DV computed in e at
1t=1?
De(e) = 0
De(f) = 1
e receives DVs Dc(f) = ∞
De(g) = ∞
from b, d, f, h Dc(g) = 1
De(h) = 1
Dc(h) = ∞
De(i) = ∞
Dc(i) = ∞ d compute
e f DV in f:
1 1
DV in h: Dc(a) = ∞
Dc(a) = ∞ Dc(b) = ∞
Dc(b) = ∞ Dc(c) = ∞
Dc(c) = ∞ 1 1 1
Dc(d) = ∞
Dc(d) = ∞ Dc(e) = 1
Dc(e) = 1 Dc(f) = 0
Dc(f) = ∞ g h i Dc(g) = ∞
1 1
Dc(g) = 1 Dc(h) = ∞
Dc(h) = 0 Dc(i) = 1 Network Layer: 5-53
Distance vector: state information
diffusion
Iterative communication, computation steps diffuses information through network:
t=0 c’s state at t=0 is at c only
a b c
8 1
c’s state at t=0 has propagated to b, and
t=1 may influence distance vector computations
up to 1 hop away, i.e., at b 1 1 t=1
t=2
c’s state at t=0 may now influence distance
t=2 vector computations up to 2 hops away, i.e.,
d e f
at b and now at a, e as well 1 1
c’s state at t=0 may influence distance vector
t=3 computations up to 3 hops away, i.e., at b,a,e
1 1 1 t=3
and now at c,f,h as well
c’s state at t=0 may influence distance vector
t=4 computations up to 4 hops away, i.e., at b,a,e, g h i
c, f, h and now at g,i as well 1 1
t=4
Distance vector: link cost changes
link cost changes: 1
y
4 1
node detects local link cost change x z
updates routing info, recalculates local DV 50
• y sees direct link to x has new cost 60, but z has said it has a path at cost of 5. So
y computes “my new cost to x will be 6, via z); notifies z of new cost of 6 to x.
• z learns that path to x via y has new cost 6, so z computes “my new cost to
x will be 7 via y), notifies y of new cost of 7 to x.
• y learns that path to x via z has new cost 7, so y computes “my new cost to
x will be 8 via y), notifies z of new cost of 8 to x.
• z learns that path to x via y has new cost 8, so z computes “my new cost to
x will be 9 via y), notifies y of new cost of 9 to x.
…
see text for solutions. Distributed algorithms are tricky!
Network Layer: 5-56
Exercise: Use DV to find the best path from R1 to each of the
destinations (fill the routing table)
R7
From From From
R2 R3 R5
1 R2 R6 R1 1 3 10
R2 0 8 15
I1
R5
R1 I2 R3 11 0 20
3 25
I3 R4 4 20
Destination Cost Next Hop ExitR4
Interface R5 5 25
R3 0
R1 0 ---- --- R6 30 20 30
R2 1 R2 I1
R7 20 18 8
R3 3 R3 10 I2
R4 5 R2 I1 DV’s received from neighbors
R5 6 R2 I1
R6 23 R3 I2
R7 18 R5 I3
Introduction to routing 2-57
Comparison of LS and DV algorithms
message complexity robustness: what happens if router
LS: n routers, O(n2) messages sent malfunctions, or is compromised?
DV: exchange between neighbors; LS:
convergence time varies • router can advertise incorrect link cost
• each router computes only its own
speed of convergence table
LS: O(n2) algorithm, O(n2) messages DV:
• may have oscillations
• DV router can advertise incorrect path
DV: convergence time varies cost (“I have a really low cost path to
• may have routing loops everywhere”): black-holing
• count-to-infinity problem
• each router’s table used by others:
error propagate thru network
intra-AS
3c
routing3a inter-AS routing intra-AS
2c
3b 2a routing
2b
1c
intra-AS
AS3
1a routing 1b AS2
1d
AS1
3c
3a other
2c
3b 2a networks
2b
1c
AS3
other 1a 1b AS2
networks
1d
AS1
2a 2c
∂
1b 3b
2d
1a 1c ∂
3a 3c
AS 2
1d 3d
AS 1 eBGP connectivity AS 3
logical iBGP connectivity
2d
AS2 router 2c receives path advertisement AS3,X (via eBGP) from AS3 router 3a
based on AS2 policy, AS2 router 2c accepts path AS3,X, propagates (via iBGP) to all
AS2 routers
based on AS2 policy, AS2 router 2a advertises (via eBGP) path AS2, AS3, X to
AS1 router 1c
Network Layer: 5-71
BGP path advertisement (more)
AS 3 3b
AS 1 1b AS3,X 3a 3c
AS3,X
AS3,X
1a 1c AS 2 3d X
2b
AS3,X
1d AS3, X
AS2,AS3,X 2a 2c
2d
2d
dest interface recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X goes through 1c”
… …
1c 1
at 1d: OSPF intra-domain routing: to get to 1c, use interface 1
X 1 at 1d: to get to X, use interface 1
… …
2d
dest interface
… … recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X goes through 1c”
1c 2
at 1d: OSPF intra-domain routing: to get to 1c, use interface 1
X 2
… … at 1d: to get to X, use interface 1
at 1a: OSPF intra-domain routing: to get to 1c, use interface 2
at 1a: to get to X, use interface 2
Network Layer: 5-75
Why different Intra-, Inter-AS routing ?
policy:
inter-AS: admin wants control over how its traffic routed, who
routes through its network
intra-AS: single admin, so policy less of an issue
scale:
hierarchical routing saves table size, reduced update traffic
performance:
intra-AS: can focus on performance
inter-AS: policy dominates over performance
2d
OSPF link weights
ISP only wants to route traffic to/from its customer networks (does not want
to carry transit traffic between other ISPs – a typical “real world” policy)
A advertises path Aw to B and to C
B chooses not to advertise BAw to C!
B gets no “revenue” for routing CBAw, since none of C, A, w are B’s customers
C does not learn about CBAw path
C will route CAw (not using B) to get to w
Network Layer: 5-78
BGP: achieving policy via advertisements (more)
B provider
x network
w A legend:
C y customer
network:
ISP only wants to route traffic to/from its customer networks (does not want
to carry transit traffic between other ISPs – a typical “real world” policy)
A,B,C are provider networks
x,w,y are customer (of provider networks)
x is dual-homed: attached to two networks
policy to enforce: x does not want to route from B to C via x
.. so x will not advertise to B a route to C
Network Layer: 5-79
BGP route selection
router may learn about more than one route to destination
AS, selects route based on:
1. local preference value attribute: policy decision
2. shortest AS-PATH
3. closest NEXT-HOP router: hot potato routing
4. additional criteria