Network Layer
Computer
Networking: A
Top Down
Approach
6th edition
Jim Kurose, Keith
Ross
Addison-Wesley
March 2012
Outline
routing
Introduction
algorithms
– distancenetworks
datagram vector
– link state
IP: Internet Protocol
– hierarchical routing
– datagram format
routing in the Internet
– IPv4 addressing
–
– RIP
ICMP
–
– OSPF
IPv6
Routing classification
Q: static or dynamic?
static:
manually enters route
information
dynamic:
“link state” algorithms
“distance vector”
algorithms
Outline
routing
Introduction
algorithms
– distancenetworks
datagram vector
– link state
IP: Internet Protocol
– hierarchical routing
– datagram format
routing in the Internet
– IPv4 addressing
–
– RIP
ICMP
–
– OSPF
IPv6
Distance Vector Routing Algorithm
• Distance Vector (DV) Protocols
– Based on an algorithm by Bellman-Ford
– Each router on the network compiles a list of the
networks it can reach (in the form of a distance vector)
and exchange this list with its neighboring routers only.
– Upon receiving vectors from each of its neighbors, the
router computes its own distance to each neighbor.
– Then, for every network X, router finds that neighbor
who is closer to X than to any other neighbor. Router
updates its cost to X. After doing this for all X, router
goes to the first step.
Distance Vector Routing Algorithm
Distance Table data structures
• Each node has its own routing table
• Row for each possible destination
• Column for each directly-attached neighbor to
node
• e.g., in node X, for dest. Y via neighbor Z :
Distance Vector Routing: overview
Each local iteration caused by: Each node:
• Local link cost change
• Message from neighbor: its
least cost path change from wait for (change in local link
cost of msg from neighbor)
neighbor
recompute distance table
• Each node notifies neighbors
only when its least cost path
if least cost path to any dest
to any destination changes
– neighbors then notify their has changed, notify
neighbors if necessary neighbors
Example: Initial Distances
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 ~ ~ 1
A 8 2 B 7 0 1 ~ 8
C ~ 1 0 2 ~
1 2 D ~ ~ 2 0 2
E D
E 1 8 ~ 2 0
Router E receives Router D Table
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 ~ ~ 1
A 8 2 B 7 0 1 ~ 8
C ~ 1 0 2 ~
1 2 D ~ ~ 2 0 2
E D
E 1 8 ~ 2 0
Router E updates cost to Router C
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 ~ ~ 1
A 8 2 B 7 0 1 ~ 8
C ~ 1 0 2 ~
1 2 D ~ ~ 2 0 2
E D
E 1 8 4 2 0
Router A receives Router B Table
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 ~ ~ 1
A 8 2 B 7 0 1 ~ 8
C ~ 1 0 2 ~
1 2 D ~ ~ 2 0 2
E D
E 1 8 4 2 0
Router A updates Cost to Router C
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 8 ~ 1
A 8 2 B 7 0 1 ~ 8
C ~ 1 0 2 ~
1 2 D ~ ~ 2 0 2
E D
E 1 8 4 2 0
Router A receives Router E Table
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 8 ~ 1
A 8 2 B 7 0 1 ~ 8
C ~ 1 0 2 ~
1 2 D ~ ~ 2 0 2
E D
E 1 8 4 2 0
Router A updates Costs to Routers C&D
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 5 3 1
A 8 2 B 7 0 1 ~ 8
C ~ 1 0 2 ~
1 2 D ~ ~ 2 0 2
E D
E 1 8 4 2 0
Final Distances
1
B C Distance to node
Info at
7 node A B C D E
A 0 6 5 3 1
A 8 2 B 6 0 1 3 5
C 5 1 0 2 4
1 2 D 3 3 2 0 2
E D
E 1 5 4 2 0
Final Distances after a Link failure
1
B C Distance to node
Info at
7 node A B C D E
A 0 7 8 10 1
A 8 2 B 7 0 1 3 8
C 8 1 0 2 9
1 2 D 10 3 2 0 11
E D
E 1 8 9 11 0
Characteristics of D.V. Routing Protocols
• Periodic Updates: Updates to the routing tables are sent at
the end of a certain time period. A typical value is 30 seconds.
• Triggered Updates: If a metric changes on a link, a router
immediately sends out an update without waiting for the end
of the update period.
• Full Routing Table Update: Most distance vector routing
protocol send their neighbors the entire routing table (not
only entries which change).
Link State Routing Protocols
• Link-State (LS) Protocols
– Based on an algorithm by Dijkstra
– Each router on the network is assumed to know the
state of the links to all its neighbors (Cost, Operating
Status, Bandwidth, Delay, etc…).
– Each router will disseminate (via reliable flooding of link
state packets, LSPs) the information about its link states
to all routers in the network.
– In this case, every router will have enough information
to build a complete map of the network and therefore is
able to construct a Shortest Path Spanning Tree from
itself to every other router.
Link State Packets
• The link state packets consist of the following
information:
– The address of the node creating the LSP.
– A list of directly connected neighbors to that node with the
cost of the link to each neighbor.
– A sequence number to make sure it is the most recent one.
– A time-to-live to insure that an LSP doesn’t circulate
indefinitely.
• A node (router) will only send an LSP if there is a failure
(change of status) to some of its links or if a timer
expires.
Dijkstra Algorithm
• Notations:
– C(i,j) = link cost from node i to j. Cost infinite, if not
direct neighbors.
– D(v) = current value of cost of path from source to
dest. V.
– P(v) = predecessor node along path from source to
v, that is neighbor of v.
– N = set of nodes whose least cost path definitely
known.
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
4
7
construct shortest path
tree by tracing 8
predecessor nodes u
3 w y z
ties can exist (can be 2
broken arbitrarily) 3
7 4
v
Dijkstra’s algorithm: example
x resulting forwarding
9
table in u:
5 7
4 destination link
8 (u,w)
v
3 w z x (u,x)
u y
2
y (u,w)
3
4 w (u,w)
7
z (u,w)
v
Example
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
Example (Continued)
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
Example (Continued)
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
Example (Continued)
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
3 ADEB 3, E 4, E
Example (Continued)
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
3 ADEB 3, E 4, E
4 ADEBC 4, E
Example (Continued)
5
3
2 B C 5
A 2 1 F
3
1 D E 2
1
B C D E F
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)
0 A 2, A 5, A 1, A ~ ~
1 AD 2, A 4, D 2, D ~
2 ADE 2, A 3, E 4, E
3 ADEB 3, E 4, E
4 ADEBC 4, E
5 ADEBCF
Outline
routing
Introduction
algorithms
– distancenetworks
datagram vector
– link state
IP: Internet Protocol
– hierarchical routing
– datagram format
routing in the Internet
– IPv4 addressing
–
– RIP
ICMP
–
– OSPF
IPv6
Hierarchical routing
our routing study thus far -
idealization
all routers identical
network “flat”
… not true in practice
scale: with 600 million administrative
destinations:
• can’t store all dest’s in routing
autonomy
tables! internet = network of
• routing table exchange would networks
swamp links! each network admin may
want to control routing in
its own network
Hierarchical Routing
• Aggregate routers into
Gateway router
regions, “autonomous
• Direct link
systems” (AS)to router in another AS
• Routers in same AS run
same routing protocol
– “intra-AS” routing
protocol
– routers in different AS
can run different intra-
AS routing protocol
Interconnected ASes
3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1
forwarding table configured
by both intra- and inter-AS
routing algorithm
Intra-AS Inter-AS
Routing
algorithm
Routing
algorithm
intra-AS sets entries
Forwarding
for internal dests
table inter-AS & intra-AS
sets entries for
external dests
Outline
• Introduction
routing algorithms
– link state
• virtual circuit and datagram networks
– distance vector
• IP: Internet Protocol
– hierarchical routing
– datagram format
• routing in the Internet
– IPv4 addressing
–
– RIP
ICMP
–
– OSPF
IPv6
Intra-AS Routing
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)
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
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
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
…. …. ....
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
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
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)
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)
• integrated uni- and multicast support:
– Multicast OSPF (MOSPF) uses same topology data
base as OSPF
• hierarchical OSPF in large domains.
Hierarchical OSPF
boundary router
backbone router
backbone
area
border
routers
area 3
internal
area 1 routers
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.