Professional Documents
Culture Documents
Network Layer
Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
IP destination address in
arriving packet’s header
1
3 2
Given a set of routers, with links
connecting the routers:
A routing algorithm finds a “good”
path from source router to
Graph abstraction
A graph is used to formulate 5
routing problems 3
v w
2 5
u 2 1 z
3
1
2
x y
graph: G = (N,E) 1
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) }
load-insensitive algorithm :
❖ a link’s cost does not explicitly reflect its current (or recent past)
level of congestion
❖ Internet routing algorithms (BGP, RIP, OSPF)
Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and ▪ link state
datagram networks ▪ distance vector
4.3 what’s inside a router ▪ hierarchical routing
notes: 5 7
4
❖ construct shortest path tree by
tracing predecessor nodes 8
❖ ties can exist (can be broken u
3 w y z
arbitrarily) 2
3
7 4
v
Dijkstra’s algorithm: another example
v w
u z
x y
➢ Each node can send some greeting messages to all its immediate
neighbors (those nodes to which it is connected directly)
➢ to collect two pieces of information for each neighboring
node:
➢ the identity of the node and
➢ the cost of the link.
➢ The combination of these two pieces of information is called the
LS packet (LSP);
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = minv {c(x,v) + dv(y) }
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
from
y 2 0 1 y 2 0 1 7
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
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 Corresponding to a Tree
When we know only one distance between two nodes, it is the least
cost.
Initial Distance Vector for an internet
Updating Distance Vectors
Count to Infinity
➢ A problem with distance-vector routing is that
➢ any decrease in cost (good news) propagates quickly,
➢ but any increase in cost (bad news) will propagate slowly.
❖ network “flat”
3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b AS1
1d ❖ forwarding table
configured by both intra-
and inter-AS routing
Intra-AS Inter-AS algorithm
Routing Routing
algorithm algorithm ▪ intra-AS sets entries
Forwarding
for internal dests
table ▪ inter-AS & intra-AS
sets entries for
external dests
Inter-AS tasks
❖ suppose router in AS1 AS1 must:
receives datagram 1. learn which dests are
destined outside of AS1: reachable through AS2,
▪ router should forward which through AS3
packet to gateway 2. propagate this
router, but which one? reachability info to all
routers in AS1
job of inter-AS routing!
3c
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
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
Example: choosing among multiple ASes
3c
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
?
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.
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
x -- 1
…. …. ....
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
…. …. ....
Another Example: A domain using RIP
Another Example: A domain using RIP
➢Autonomous system with
➢seven networks and
➢four routers with table of each router.
1. Add one hop to the hop count for each advertised destination.
transport transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
physical physical
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
❖ IS-IS routing protocol: nearly identical to OSPF
Hierarchical OSPF
boundary router
backbone router
backbone
area
border
routers
area 3
internal
routers
area 1
area 2
Hierarchical OSPF
❖ two-level hierarchy: local area, backbone.
▪ link-state advertisements only in area
▪ each nodes has detailed area topology; only know
direction (shortest path) to nets in other areas.
❖ area border routers: “summarize” distances to nets in
own area, advertise to other Area Border routers.
❖ backbone routers: run OSPF routing limited to
backbone.
❖ boundary routers: connect to other AS’s.