0% found this document useful (0 votes)
8 views79 pages

Network Layer - Part 3

Chapter 4 of the document discusses the network layer, focusing on routing algorithms such as link state and distance vector, and the structure of routers. It explains the concepts of IP addressing, routing protocols like RIP, OSPF, and BGP, and introduces Dijkstra's and Bellman-Ford algorithms for finding least-cost paths. The chapter also covers the differences between global and decentralized routing, as well as static and dynamic routing methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views79 pages

Network Layer - Part 3

Chapter 4 of the document discusses the network layer, focusing on routing algorithms such as link state and distance vector, and the structure of routers. It explains the concepts of IP addressing, routing protocols like RIP, OSPF, and BGP, and introduces Dijkstra's and Bellman-Ford algorithms for finding least-cost paths. The chapter also covers the differences between global and decentralized routing, as well as static and dynamic routing methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 79

Network Layer

Chapter 4
Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
 link state
4.2 virtual circuit and datagram networks
 distance vector
4.3 what’s inside a router
 hierarchical routing
4.4 IP: Internet Protocol
4.6 routing
 datagramin the Internet
format
 RIP
IPv4 addressing
 OSPF
ICMP
 BGP
IPv6
4.7 broadcast and multicast routing

Network Layer 4-2


Interplay between routing, forwarding
routing algorithm determines
routing algorithm
end-end-path through network
forwarding table determines
local forwarding table
local forwarding at this router
dest address output
address-range 1 3 link
address-range 2 2
address-range 3 2
address-range 4 1

IP destination address in
arriving packet’s header
1
3 2

Network Layer 4-3


Graph abstraction
5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y
graph: G = (N,E)

N = set of routers = { u, v, w, x, y, z }

E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }

aside: graph abstraction is useful in other network contexts, e.g.,


P2P, where N is set of peers and E is set of TCP connections

Network Layer 4-4


Graph abstraction: costs
5
c(x,x’) = cost of link (x,x’)
3 e.g., c(w,z) = 5
v w 5
2
u cost could always be 1, or
2
3
1 z inversely related to bandwidth,
1 2 or inversely related to
x 1
y
congestion

cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)

key question: what is the least-cost path between u and z ?


outing algorithm: algorithm that finds that least cost path

Network Layer 4-5


Routing algorithm classification
Q: global or decentralized Q: static or dynamic?
information? static:
global:  routes change slowly over time
 all routers have complete topology,
dynamic:
link cost info  routes change more quickly
 “link state” algorithms
 periodic update
decentralized:  in response to link cost changes
 router knows physically-connected
neighbors, link costs to neighbors
 iterative process of computation,
Q: load sensitive or
exchange of info with neighbors insensitive?
 “distance vector” algorithms Load sensitive:
 link costs reflect the current level
of congestion
Load Insensitive:
 A link’s cost does not explicitly
reflect its current (or recent past)
level of congestion Network Layer 4-6
Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
 link state
4.2 virtual circuit and datagram networks
 distance vector
4.3 what’s inside a router
 hierarchical routing
4.4 IP: Internet Protocol
4.6 routing
 datagramin the Internet
format
 RIP
IPv4 addressing
 OSPF
ICMP
 BGP
IPv6
4.7 broadcast and multicast routing

Network Layer 4-7


A Link-State Routing Algorithm
Dijkstra’s algorithm
notation:
 c(x,y):
net topology, linkfrom
link cost costsnode x to y; = ∞ if not direct
neighbors
known to all nodes
  accomplished
D(v): via “link
current value ofstate
cost of path from source to dest. v
broadcast”
 p(v): predecessor
 all nodes have samenode
info along path from source to v

 N': set of nodes
computes whose
least cost least cost path definitively known
paths
from one node (‘source”)
to all other nodes
 gives forwarding table for
that node
 iterative: after k
iterations, know least cost
path to k dest.’s

Network Layer 4-8


Dijsktra’s Algorithm
1 Initialization:
2 N' = {u}
3 for all nodes v
4 if v adjacent to u
5 then D(v) = c(u,v)
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) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'

Network Layer 4-9


Dijsktra’s Algorithm
1 Initialization:
2 N' = {u} Create a set N' (a subset of vertices) and initialize it with the source vertex u.
3 for all nodes v If v is adjacent to u, set the tentative distance D(v) from
4 if v adjacent to u the source to v as the weight of the edge between u
and v, denoted as c(u, v) else set the tentative distance
5 then D(v) = c(u,v) D(v) to infinity (∞)
6 else D(v) = ∞
7
Find a vertex w that is not in N' and
8 Loop has the minimum tentative distance
9 find w not in N' such that D(w) is a minimum D(w) among all such vertices. Add the
vertex w to the set N’. Iterate through
10 add w to N' all vertices v that are adjacent to w
11 update D(v) for all v adjacent to w and not in N' :and not in N’. Update the tentative
12 D(v) = min( D(v), D(w) + c(w,v) ) distance D(v) for vertex v. The new
distance to v is the minimum of
13 /* new cost to v is either old cost to v or known [ its current tentative distance D(v)]
14 shortest path cost to w plus cost from w to v */ and [the tentative distance to w (D(w))
+ the weight of the edge between w
15 until all nodes in N' and v (c(w, v))].

Network Layer 4-10


Dijkstra’s algorithm: example
D(v) D(w) D(x) D(y) D(z)
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
4 uwxvy 12,y
5 uwxvyz x
9

notes: 5 7
4
 construct shortest path
tree by tracing 8
predecessor nodes 3
u w y z
 ties can exist (can be 2
broken arbitrarily)
3
7 4
v
Network Layer 4-11
Dijkstra’s algorithm: another example
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

5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y

Network Layer 4-12


Dijkstra’s algorithm: example (2)
resulting shortest-path tree from u:

v w
u z
x y

resulting forwarding table in u:


destination link
v (u,v)
x (u,x)
y (u,x)
w (u,x)
z (u,x)
Network Layer 4-13
Dijkstra’s algorithm, discussion
algorithm complexity: n nodes
 each iteration: need to check all nodes, w, not in N
 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
1
C C 0 1
C 1+e C 0
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 cost
resulting in new costs
Network Layer 4-14
Consider the following network. With the indicated link costs, use
Dijkstra’s shortest-path algorithm to compute the shortest path
from x to all network nodes. Show how the algorithm works by
computing a table.
Consider the network shown . Using Dijkstra’s algorithm, and showing your work using a table,
do the following:
a. Compute the shortest path from t to all network nodes.
b. Compute the shortest path from u to all network nodes.
c. Compute the shortest path from v to all network nodes.
d. Compute the shortest path from w to all network nodes.
e. Compute the shortest path from y to all network nodes.
f. Compute the shortest path from z to all network nodes.

http://gaia.cs.umass.edu/kurose_ross/interactive/dij.php
http://gaia.cs.umass.edu/kurose_ross/interactive/dij_advanced.php
Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
 link state
4.2 virtual circuit and datagram networks
 distance vector
4.3 what’s inside a router
 hierarchical routing
4.4 IP: Internet Protocol
4.6 routing
 datagramin the Internet
format
 RIP
IPv4 addressing
 OSPF
ICMP
 BGP
IPv6
4.7 broadcast and multicast routing

Network Layer 4-17


Distance vector algorithm
Bellman-Ford equation (dynamic programming)

let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min
v
{c(x,v) + dv(y) }

cost from neighbor v to destination


cost to neighbor v

min taken over all neighbors v of x


Network Layer 4-18
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 1
y
c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
ode achieving minimum is next
op in shortest path, used in forwarding table
Network Layer 4-19
Distance vector algorithm
 Dx(y) = estimate of least cost from x to y
 x maintains distance vector Dx = [Dx(y): y є N ]
 node x:
 knows cost to each neighbor v: c(x,v)
 maintains its neighbors’ distance vectors. For
each neighbor v, x maintains
Dv = [Dv(y): y є N ]

Network Layer 4-20


Distance vector algorithm
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

 under minor, natural conditions, the


estimate Dx(y) converge to the actual
least cost dx(y)

Network Layer 4-21


Distance vector algorithm
iterative, asynchronous: each node:
each local iteration
caused by:
 local link cost change wait for (change in local link
cost or msg from neighbor)
 DV update message from
neighbor
distributed: recompute estimates
 each node notifies
neighbors only when its
DV changes if DV to any dest has
 neighbors then notify their changed, notify neighbors
neighbors if necessary

Network Layer 4-22


Distance vector: example
DV in
a:
Da(a)=0
Da(b) = a b c
8 1
8

t=0 Da(c) =
∞ 1 1
Da(d) =
 All nodes 1
have distance Da(e) =
estimates to A few asymmetries:
∞ d e f  missing link
nearest Da(f) = 1 1
neighbors  larger cost

(only)
Da(g) =
∞ 1 1 1
 All nodes send
Da(h) =
their local

distance
Da(i) =
vector to their g h i
neighbors ∞ 1 1
Distance vector example:
iteration
a b c
8 1

t=1 1 1
All nodes:
 receive
distance
vectors from d e f
neighbors 1 1
 compute their
new local
distance vector 1 1 1
 send their new
local distance
vector to
neighbors g h i
1 1
Distance vector example:
iteration
a
compute compute
b compute
c
8 1

t=1 1 1
All nodes:
 receive
distance
vectors from d
compute e
compute compute
f
neighbors 1 1
 compute their
new local
distance vector 1 1 1
 send their new
local distance
vector to
neighbors g
compute h
compute i
compute
1 1
Distance vector example:
iteration
a b c
8 1

t=1 1 1
All nodes:
 receive
distance
vectors from d e f
neighbors 1 1
 compute their
new local
distance vector 1 1 1
 send their new
local distance
vector to
neighbors g h i
1 1
Distance vector example:
iteration
a b c
8 1

t=2 1 1
All nodes:
 receive
distance
vectors from d e f
neighbors 1 1
 compute their
new local
distance vector 1 1 1
 send their new
local distance
vector to
neighbors g h i
1 1
Distance vector example:
iteration
compute
a compute
b compute
c
2 1

t=2 1 1
All nodes:
 receive
distance
vectors from d
compute compute
e compute
f
neighbors 1 1
 compute their
new local
distance vector 1 1 1
 send their new
local distance
vector to
neighbors g
compute compute
h compute
i
8 1
Distance vector example:
iteration
a b c
8 1

t=2 1 1
All nodes:
 receive
distance
vectors from d e f
neighbors 1 1
 compute their
new local
distance vector 1 1 1
 send their new
local distance
vector to
neighbors g h i
1 1
Distance vector example:
iteration
…. and so on

Let’s next take a look at the iterative computations at nodes


Distance vector example:
computation DV in b:
Db(a) = 8 Db(f) = ∞
DV in c:
Dc(a) = ∞
Dc(b) = 1
Db(c) = 1 Db(g) = ∞ Dc(c) = 0
DV in a: Db(d) = ∞ Db(h) = ∞ Dc(d) = ∞
Da(a)=0 Db(e) = 1 Db(i) = ∞ Dc(e) = ∞
Da(b) = 8 Dc(f) = ∞
Da(c) = ∞ a b c Dc(g) = ∞
8 1
Da(d) = 1 Dc(h) = ∞
Dc(i) = ∞
t=1 Da(e) = ∞
Da(f) = ∞ 1 1
 b receives Da(g) = ∞ DV in e:
DVs from a, c, Da(h) = ∞ De(a) = ∞
e Da(i) = ∞ De(b) = 1
d e f De(c) = ∞
1 1
De(d) = 1
De(e) = 0
De(f) = 1
1 1 1
De(g) = ∞
De(h) = 1
De(i) = ∞
g h i
1 1
Distance vector example: DV in b: DV in c:
Dc(a) = ∞

computation
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
DV in a: Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Da(a)=0 Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(b) = 8 Dc(e) = ∞
Da(c) = ∞ a bb c Dc(f) = ∞
8 compute 1
Da(d) = 1 Dc(g) = ∞
Dc(h) = ∞
t=1 Da(e) = ∞
Da(f) = ∞ 1 1 Dc(i) = ∞
 b receives DVs Da(g) = ∞ DV in e:
from a, c, e, Da(h) = ∞ De(a) = ∞
computes: e
Da(i) = ∞ De(b) = 1
d e f De(c) = ∞
1
Db(a) = min{cb,a+Da(a), cb,c +Dc(a), cb,e+De(a)} = min{8,∞,∞} =8 1
De(d) = 1
Db(c) = min{cb,a+Da(c), cb,c +Dc(c), c b,e +De(c)} = min{∞,1,∞} = 1
De(e) = 0
Db(d) = min{cb,a+Da(d), cb,c +Dc(d), c b,e +De(d)} = min{9,2,∞} = 2 De(f) = 1
1 1 1
Db(e) = min{cb,a+Da(e), cb,c +Dc(e), c b,e +De(e)} = min{∞,∞,1} = 1 De(g) = ∞
Db(f) = min{cb,a+Da(f), cb,c +Dc(f), c b,e +De(f)} = min{∞,∞,2} = 2
DV in b: De(h) = 1
Db(g) = min{cb,a+Da(g), cb,c +Dc(g), c b,e+De(g)} = min{∞, ∞, ∞} = ∞ Db(a) = 8 Db(f) =2 De(i) = ∞
g h 1Db(c) = 1 i =∞
Db(g)
1 ∞, 2} = 2
Db(h) = min{cb,a+Da(h), cb,c +Dc(h), c b,e+De(h)} = min{∞,
Db(d) = 2 Db(h) = 2
Db(i) = min{cb,a+Da(i), cb,c +Dc(i), c b,e+De(i)} = min{∞, ∞, ∞} = ∞ Db(e) = 1 Db(i) = ∞
Distance vector example: DV in b: DV in c:
Dc(a) = ∞

computation
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
DV in a: Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Da(a)=0 Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(b) = 8 Dc(e) = ∞
Da(c) = ∞ a b c Dc(f) = ∞
8 1
Da(d) = 1 Dc(g) = ∞
Dc(h) = ∞
t=1 Da(e) = ∞
Da(f) = ∞ 1 1 Dc(i) = ∞
 c receives DVs Da(g) = ∞ DV in e:
from b Da(h) = ∞ De(a) = ∞
Da(i) = ∞ De(b) = 1
d e f De(c) = ∞
1 1
De(d) = 1
De(e) = 0
De(f) = 1
1 1 1
De(g) = ∞
De(h) = 1
De(i) = ∞
g h i
1 1
Distance vector example:
computation DV in b:
Db(a) = 8
Db(c) = 1
Db(f) = ∞
Db(g) = ∞
DV in c:
Dc(a) = ∞
Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Dc(e) = ∞
a b c
compute Dc(f) = ∞
8 1
Dc(g) = ∞
Dc(h) = ∞
t=1 1 1 Dc(i) = ∞
 c receives DVs
from b computes:

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 exercises
Dc(f) = ∞ for more examples:
Dc(h) = min{cbc,bg+Db(h)} = 1+ ∞ = ∞ h i http://gaia.cs.umass.edu/kurose_ross/interactive/
Dc(g) = ∞
Dc(i) = min{cc,b+Db(i)} = 1+ ∞ = ∞
Dc(h) = ∞
Dc(i) = ∞
Distance vector example: DV in b:

computation
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
at1t=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:
DV in h: 1 1
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
Dc(i) = 1
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 d, f, h 1 1 1 t=3

c’s state at t=0 may influence distance vector


t=4 g
computations up to 4 hops away, i.e., at g, i 1
h 1
i
t=4
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
Network Layer 4-38
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 y 2 0 1

from
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

y 2 0 1 y 2 0 1 7
from

y 2 0 1

from
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
Network Layer 4-39
Distance vector: link cost changes
link cost changes: 1
 node detects local link cost y
4 1
change
 updates routing info,
x z
50
recalculates
distance vector
 if DV changes, notify
“good t0 : y detects link-cost change, updates its DV, informs its
neighbors
news neighbors.
travels t1 : z receives update from y, updates its table, computes new
fast” least cost to x , sends its neighbors its DV.

t2 : y receives z’s update, updates its distance table. y’s least costs
do not change, so y does not send a message to z.

Network Layer 4-40


Distance vector: link cost changes
link cost changes: 60
 node detects local link cost y
4 1
change
 bad news travels slow -
x z
50
“count to infinity” problem!
 44 iterations before
algorithm stabilizes: see
poisoned
text reverse:
 If Z routes through Y to get to X :
 Z tells Y its (Z’s) distance to X is infinite (so Y
won’t route to X via Z)
 will this completely solve count to infinity
problem?
loops involving three or more nodes (rather than
simply two immediately neighboring nodes)
will not be detected by the poisoned reverse technique.
Network Layer 4-41
Consider the network shown below, and assume that each node initially
knows the costs to each of its neighbors. Consider the distance-vector
algorithm and show the distance table entries at node z.

http://gaia.cs.umass.edu/kurose_ross/interactive/disVector.php
Comparison of LS and DV algorithms
message complexity robustness: what happens if
 LS: with n nodes, E links, O(nE) router malfunctions?
msgs sent LS:
 DV: exchange between neighbors  node can advertise incorrect
only link cost
 convergence time varies  each node computes only its
own table
speed of convergence
 LS: O(n2) algorithm requires O(nE)
DV:
msgs  DV node can advertise
 may have oscillations incorrect path cost
 each node’s table used by
 DV: convergence time varies
others
 may be routing loops
 error propagate thru
 count-to-infinity problem
network

Network Layer 4-43


Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
 link state
4.2 virtual circuit and datagram networks
 distance vector
4.3 what’s inside a router
 hierarchical routing
4.4 IP: Internet Protocol
4.6 routing
 datagramin the Internet
format
 RIP
IPv4 addressing
 OSPF
ICMP
 BGP
IPv6
4.7 broadcast and multicast routing

Network Layer 4-44


Hierarchical routing
our routing study thus far -
idealization
 all routers identical
 network “flat”

… not true in practice


scale: with billios of administrative autonomy
destinations:  internet = network of
 can’t store all dest’s in networks
routing tables!  each network admin may
 routing table exchange want to control routing in
would swamp links! its own network

Network Layer 4-45


Hierarchical routing
 aggregate routers into regions, “autonomous systems”
(AS or domains)

intra-AS (aka “intra-domain”): routing among routers


within same AS (“network”)
 all routers in AS must run same intra-domain protocol
 routers in different AS can run different intra-domain

routing protocols
 gateway router: at “edge” of its own AS, has link(s) to

router(s) in other AS’es

inter-AS (aka “inter-domain”): routing among AS’es


 gateways perform inter-domain routing (as well as intra-
domain routing)
Network Layer 4-46
Interconnected ASes
forwarding table configured by
intra- and inter-AS routing
algorithms
 intra-AS routing determine
Intra-AS
Routing
Inter-AS
Routing entries for destinations within
forwarding
table
AS
 inter-AS & intra-AS determine
entries for external
intra-AS
destinations
3c
routing3a inter-AS routing intra-AS
2c
3b 2a routing
2b
1c
AS3 intra-AS
1a routing 1b AS2
1d
AS1

Network Layer: 5-47


Inter-AS routing: a role in intradomain forwarding
 suppose router in AS1 receives AS1 inter-domain routing must:
datagram destined outside of AS1: 1. learn which destinations reachable
• router should forward packet through AS2, which through AS3
to gateway router in AS1, but 2. propagate this reachability info to all
which one? routers in AS1

3c
3a other
2c
3b 2a networks
2b
1c
AS3
other 1a 1b AS2
networks
1d
AS1
the intra-AS routing protocols running
three ASs: AS1, AS2, and AS3 in AS1, AS2, and AS3 need not be the
same
AS1 has four routers—1a, 1b, 1c, and 1d— which run the
intra-AS routing protocol used within AS1. Thus, each of routers 1b, 1c, 2a, and 3a
these four routers knows how to forward packets along the
optimal path to any destination within AS1
are all gateway routers
Network Layer: 5-48
Example: setting forwarding table in router 1d
 suppose AS1 learns (via inter-AS protocol) that subnet x
reachable via AS3 (gateway 1c), but not via AS2
 inter-AS protocol propagates reachability info to all internal
routers
 router 1d determines from intra-AS routing info that its interface
I is on the least cost path to 1c
 installs forwarding table entry (x,I)

3c … x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d

Network Layer 4-49


Example: choosing among multiple ASes
 now suppose AS1 learns from inter-AS protocol that subnet
x is reachable from AS3 and from AS2.
 to configure forwarding table, router 1d must determine
which gateway it should forward packets towards for dest x
 this is also job of inter-AS routing protocol!

3c … x …
3b
3a …
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
?
Network Layer 4-50
Example: choosing among multiple ASes
 now suppose AS1 learns from inter-AS protocol that subnet
x is reachable from AS3 and from AS2.
 to configure forwarding table, router 1d must determine
towards which gateway it should forward packets for dest x
 this is also job of inter-AS routing protocol!
 hot potato routing: send packet towards closest of two
routers.

use routing info determine from


learn from inter-AS hot potato routing: forwarding table the
from intra-AS
protocol that subnet choose the gateway interface I that leads
protocol to determine
x is reachable via that has the to least-cost gateway.
costs of least-cost
multiple gateways smallest least cost Enter (x,I) in
paths to each
of the gateways forwarding table

Network Layer 4-51


Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
 link state
4.2 virtual circuit and datagram networks
 distance vector
4.3 what’s inside a router
 hierarchical routing
4.4 IP: Internet Protocol
4.6 routing
 datagramin the Internet
format
 RIP
IPv4 addressing
 OSPF
ICMP
 BGP
IPv6
4.7 broadcast and multicast routing

Network Layer 4-52


Intra-AS Routing (in 2013)
 also known as interior gateway protocols (IGP)
 most common intra-AS routing protocols:
 RIP: Routing Information Protocol
 OSPF: Open Shortest Path First
 IGRP: Interior Gateway Routing Protocol (Cisco
proprietary)

Network Layer 4-53


Intra-AS routing: routing within an AS
most common intra-AS routing protocols:
 RIP: Routing Information Protocol [RFC 1723]
• classic DV: DVs exchanged every 30 secs
• no longer widely used
 EIGRP: Enhanced Interior Gateway Routing Protocol
• DV based
• formerly Cisco-proprietary for decades (became open in
2013 [RFC 7868])
 OSPF: Open Shortest Path First [RFC 2328]
• link-state routing
• IS-IS protocol (ISO standard, not RFC standard) essentially
Network Layer: 5-54

same as OSPF
RIP ( Routing Information Protocol)
 included in BSD-UNIX distribution in 1982
 distance vector algorithm
 distance metric: # hops (max = 15 hops), each link has cost 1
 DVs exchanged with neighbors every 30 sec in response message (aka
advertisement)
 each advertisement: list of up to 25 destination subnets (in IP
addressing sense)

from router A to destination subnets:


u v subnet hops
w u 1
A B
v 2
w 2
x x 3
z C D y 3
y z 2
Network Layer 4-55
RIP: example

z
w x y
A D B

C
routing table in router D
destination subnet next router # hops to dest
w A
2
y B
2
z B
7 Network Layer 4-56
RIP: example
A-to-D advertisement
dest next hops
w - 1
x - 1
z C 4
…. … ... z
w x y
A D B

C
routing table in router D
destination subnet next router # hops to dest
w A 2
y B 2
A 5
z B 7
x -- 1
…. …. ....
Network Layer 4-57
RIP: link failure, recovery
if no advertisement heard after 180 sec -->
neighbor/link declared dead
 routes via neighbor invalidated
 new advertisements sent to neighbors
 neighbors in turn send out new advertisements (if tables
changed)
 link failure info quickly (?) propagates to entire net
 poison reverse used to prevent ping-pong loops (infinite
distance = 16 hops)

Network Layer 4-58


RIP table processing
 RIP routing tables managed by application-level
process called route-d (daemon)
 advertisements sent in UDP packets, periodically
repeated
routed routed

transport transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
physical physical

Network Layer 4-59


Consider the routing table in D

suppose that D receives from A the following


advertisement:

Will the table in D change? If so how?


OSPF (Open Shortest Path First)
 “open”: publicly available
 uses link state algorithm
 LS packet dissemination
 topology map at each node
 route computation using Dijkstra’s algorithm
 OSPF advertisement carries one entry per neighbor
 advertisements flooded to entire AS
 carried in OSPF messages directly over IP (rather than TCP
or UDP

Network Layer 4-61


OSPF “advanced” features (not in RIP)
 security: all OSPF messages authenticated (to prevent
malicious intrusion)
 multiple same-cost paths allowed (only one path in
RIP)
 for each link, multiple cost metrics for different TOS
(e.g., satellite link cost set “low” for best effort ToS;
high for real time ToS)
 integrated uni- and multicast support:
 Multicast OSPF (MOSPF) uses same topology data
base as OSPF
 hierarchical OSPF in large domains.

Network Layer 4-62


Hierarchical OSPF
 two-level hierarchy: local area, backbone.
• link-state advertisements flooded only in area, or backbone
• each node has detailed area topology; only knows direction to
reach other destinations boundary router:
area border routers: connects to other
“summarize” distances ASes
backbone
to destinations in own backbone router:
area, advertise in runs OSPF
backbone limited to
local routers: backbone
• flood LS in area only area 3
• compute routing within
area internal
• forward packets to area 1 routers
outside via area border area 2
router

Network Layer: 5-63


Interconnected ASes

intra-AS
3c
routing3a inter-AS routing intra-AS
2c
3b 2a routing
2b
1c
AS3 intra-AS
1a routing 1b AS2
1d
AS1

intra-AS (aka “intra-domain”): routing among routers within same


AS (“network”)
inter-AS (aka “inter-domain”): routing among AS’es
Network Layer Control Plane: 5-64
Internet inter-AS routing: BGP
 BGP (Border Gateway Protocol): the de facto inter-domain routing
protocol
• “glue that holds the Internet together”
 allows subnet to advertise its existence, and the destinations it can
reach, to rest of Internet: “I am here, here is who I can reach, and
how”
 BGP provides each AS a means to:
• obtain destination network reachability info from neighboring
ASes (eBGP) eBGP (external BGP) is used to exchange routing information between different
ASes.
• determine routes to other networks based on reachability
information and policyBGP routing policies are used to control how BGP routers make
routing decisions and to shape the flow of traffic in the network.
• propagate reachability information to all AS-internal routers
(iBGP) iBGP (internal BGP) is used to distribute the BGP routing
information within an AS
• advertise (to neighboring networks) destination reachability
info BGP routers can advertise the reachability information of Network Layer 4-65
their AS's networks to neighboring ASes.
eBGP, iBGP connections
2b

2a 2c

1b 3b
2d
1a 1c ∂
3a 3c
AS 2
1d 3d

AS 1 eBGP connectivity AS 3
logical iBGP connectivity

1c gateway routers run both eBGP and iBGP protocols

Network Layer: 5-66


BGP basics
 BGP session: two BGP routers (“peers”) exchange
BGP messages:
 advertising paths to different destination network prefixes
(“path vector” protocol)
 exchanged over semi-permanent TCP connections

 when AS3 advertises a prefix to AS1:


 AS3 promises it will forward datagrams towards that prefix
 AS3 can aggregate prefixes in its advertisement

3c
BGP
3a message
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d

Network Layer 4-67


BGP basics: distributing path information
 using eBGP session between 3a and 1c, AS3 sends prefix
reachability info to AS1.
 1c can then use iBGP do distribute new prefix info to all routers in
AS1
 1b can then re-advertise new reachability info to AS2 over 1b-to-
2a eBGP session
 when router learns of new prefix, it creates entry for
prefix in its forwarding table.

eBGP session
3a iBGP session
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d

Network Layer 4-68


Path attributes and BGP routes
 advertised prefix includes BGP attributes
 prefix + attributes = “route”
 two important attributes:
 AS-PATH: contains ASs through which prefix advertisement
has passed: e.g., AS 67, AS 17 When a prefix is passed into an AS, the AS adds
its ASN to the AS-PATH attribute.

to detect and prevent looping advertisements


 NEXT-HOP: indicates specific internal-AS router to next-hop
AS. (may be multiple links from current AS to next-hop-AS)
 gateway router receiving
critical link between route advertisement
the inter-AS uses
and intra-AS routing protocols.

import policy to accept/decline


 Also involves a policy-based routing
 e.g., never route through AS x

Network Layer 4-69


BGP route selection
 router may learn about more than 1 route to
destination AS, selects route based on:
1. local preference value attribute: policy decision
The routes with the highest local preference values are selected. Decided by
Administrator
2. shortest AS-PATH
From the remaining routes (all with the same local preference value), the route with
the shortest AS-PATH is selected.
3. closest NEXT-HOP router: hot potato routing
From the remaining routes (all with the same local preference value and the same
AS-PATH length), the least-cost path router is selected
4. additional criteria
If more than one route still remains, the router uses BGP identifiers to select the
route.

Network Layer 4-70


Why different Intra-, Inter-AS routing ?
policy: AS administrators use policy to influence the routing of
traffic between different ASes.
 inter-AS: admin wants control over how its traffic
routed, who routes through its net.
 intra-AS: single admin, so nodictate
policy decisions needed
the internal routing policy

scale:
 inter-AS: hierarchical routing saves table size,
reduced update traffic Intra-AS routing typically doesn't require such aggregation
performance:
 inter-AS: policy may dominate over performance
AS administrators often have to balance routing decisions
based on policy requirements
 intra-AS: can focus on performance
best performance, low latency, and efficient resource
utilization can be the primary goal.
Network Layer 4-71
Consider the network shown below. Suppose AS3 and AS2 are running OSPF for
their intra-AS routing protocol. Suppose AS1 and AS4 are running RIP for their intra-
AS routing protocol. Suppose eBGP and iBGP are used for the inter- S routing
protocol. Initially suppose there is no physical link between AS2 and AS4.
a. Router 3c learns about prefix x from which routing protocol: OSPF, RIP, eBGP, or
Ibgp?
b. Router 3a learns about x from which routing protocol?
c. Router 1c learns about x from which routing protocol?
d. Router 1d learns about x from which routing protocol?
Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
 link state
4.2 virtual circuit and datagram networks
 distance vector
4.3 what’s inside a router
 hierarchical routing
4.4 IP: Internet Protocol
4.6 routing
 datagramin the Internet
format
 RIP
IPv4 addressing
 OSPF
ICMP
 BGP
IPv6
4.7 broadcast and multicast routing

Network Layer 4-73


Broadcast routing
 deliver packets from source to all other nodes
 source duplication is inefficient:
duplicate
duplicate R1 creation/transmission R1
duplicate
R2 R2

R3 R4 R3 R4

source in-network
duplication duplication
 source duplication: How does it know all
the destinations?
additional protocol mechanisms
(such as a broadcast
membership or destination-
registration protocol) would be Network Layer 4-74
In-network duplication
 flooding: when node receives broadcast packet,
sends copy to all neighbors
 problems: cycles & broadcast storm
 controlled flooding: node only broadcasts pkt if it
hasn’t broadcast same packet before
 node keeps track of packet ids already broadcasted
 or reverse path forwarding (RPF): only forward packet
if it arrived on shortest path between node and source
 spanning tree:
 no redundant packets received by any node

Network Layer 4-75


Spanning tree
 first construct a spanning tree
 nodes then forward/make copies only along
spanning tree

A A

B B
c c

D D
F E F E

G G
(a) broadcast initiated at A (b) broadcast initiated at D

Network Layer 4-76

You might also like