04 - Intra-Domain Routing
04 - Intra-Domain Routing
• J. F. Kurose and K. W. Ross. Computer Networking: A Top-Down Approach, 7th Edition (2017).
Chapters 4.5 routing algorithms, 4.6 routing in the Internet
• R. Malhotra. IP Routing: Help for Network Administrators, 2002. Chapter 1 Starting Simple pages 1 –
9, Chapter 6 Open Shortest Path First (OSPF) pages 107 – 156
• Douglas E. Comer. Internetworking with TCP/IP Volume One 6th Edition. Chpt. 12 and Chpt. 14
Charles M Adrah, Ph.D.
Lecture goals
▪ Understand the purpose of routing
• Routing protocols
Link Layer 2
Outline
▪ IP routing
▪ Algorithms for routing protocols
▪ Link state
▪ Distance vector
▪ Interconnected autonomous systems
▪ Intra-domain routing
▪ RIP
▪ OSPF
Interplay between routing, forwarding
routing algorithm routing algorithm determines
end-end-path through network
forwarding table determines
local forwarding table
dest address output link local forwarding at this router
address-range 1 3
address-range 2 2
address-range 3 2
address-range 4 1
IP destination address in
arriving packet’s header
1
3 2
The routing of IP packets in an IP network is the set of tasks required to move an IP packet
from router to router to its destination, as specified in the IP header field.
Routing protocols
routing algorithm
• RIP
Routing algorithm classification
Q: global or decentralized information?
global:
• all routers have complete topology, link cost info
• “link state” algorithms
decentralized:
• router knows physically-connected neighbors, link costs to
neighbors
• iterative process of computation, exchange of info with
neighbors
• “distance vector” algorithms
Network Layer 14
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) }
Network Layer 15
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
1 2 bandwidth,
x 1
y or inversely related to
congestion
Network Layer 20
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 x
5 uwxvyz 9
notes: 5 7
4
❖ construct shortest path tree by
tracing predecessor nodes 8
❖ ties can exist (can be broken 3 w y z
arbitrarily) u
2
3
7 4
v
Network Layer 21
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
resulting forwarding table in
5 u: destination link
v (u,v)
3
v w 5 x (u,x)
2
u 2 1 z y (u,x)
3
1 2 w (u,x)
x 1
y
z (u,x)
Network Layer 22
Outline
▪ IP routing
▪ Algorithms for routing protocols
• Link state
• Distance vector
• RIP
Distance Vector (DV) algorithm
• Tell your neighbours what you know about every other
one.
• Broadcast routing information to all neighbouring routers
(each router tells all of its neighbours the routes it knows)
• When a router receives a route that is not in its routing
table, it adds the route to its table
• If the router receives a route that is already in its routing
table, it keeps the shorter route in its table
• DV algorithms are sometimes also described as routing by
rumour:
• bad routing information propagates just as quickly as
good information
24
Distance vector algorithm
Bellman-Ford equation (dynamic programming)
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min {c(x,v) + dv(y) }
v
v 3
w clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
2 5
u 2 1 z
3
1 2
x 1
y
B-F equation says:
du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) }
= min {2 + 5, 1 + 3, 5 + 3} = 4
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:
Network Layer 28
Distance vector algorithm
Key operations:
▪ Each node sends its own distance vector estimate to neighbors (i.e.,
directly connected to)
▪ When an update arrives at a router K from router J, K examines the set
of destinations reported and the distance to each and applies three
rules:
1. If J lists a destination that K does not have in its RIB, K adds a new
entry to its RIB with the next hop of J
2. If J knows a shorter way to reach a destination D, K replaces the
next hop in its RIB entry for D with J
3. If K’s RIB entry for a destination already lists J as the next hop and
J’s distance to the destination has changed, K replaces the
distance its RIB entry
29
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
node x cost to Dx(z)=min{c(x,y) + Dy(z), c(x,z) + Dz(z)}
table x y z = min{2+1 , 7+0} = 3
x 0 2 7 x y z
from
y ∞∞ ∞ cost to
z ∞∞ ∞
x 0 2 3
from
node y cost to y 2 0 1
table x y z z 7 1 0
y
x ∞ ∞ ∞ 2 1
z
from
y 2 0 1 x
7
z ∞∞ ∞
node z cost to
table x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
Network Layer 30
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z) = min{c(x,y) +
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
node x cost to cost to cost to
table x y z x y z x y z = min{2+1 , 7+0} = 3
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
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
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
Network Layer 31
Slow convergence problem
34
Outline
▪ IP routing
▪ Algorithms for routing protocols
• Link state
• Distance vector
• RIP
Making routing scalable: Hierarchical routing
our routing study thus far - idealization
❖ all routers identical
❖ network “flat”
… not true in practice
Network Layer 36
Hierarchical routing
• Aggregate routers into regions, “autonomous systems” (AS)
• AS is identified by its globally unique autonomous system
number (ASN)
• Routers in same AS run same routing protocol
– “intra-AS” routing protocol
– also known as interior gateway protocols (IGP)
– routers in different AS can run different intra-AS routing protocol
• gateway router:
– at “edge” of its own AS
– has link to router in another AS
Network Layer 37
Interconnected ASs
Intra-AS routing (Interior Gateway Protocols- IGP) Inter-AS routing (Exterior gateway protocols- EGP)
• Routing among hosts, routers in same AS • Routing among ASs
• All routers in AS must run same intra- • Routers in different AS can run different
domain protocol intra-domain routing protocol
▪ RIP: Routing Information Protocol
▪ OSPF: Open Shortest Path First
▪ IGRP: Interior Gateway Routing Protocol (Cisco
proprietary)
Why different Intra-, Inter-AS routing?
Policy:
• Inter-AS: admin wants control over how its traffic routed,
who routes through its net
• Intra-AS: single admin, so no policy decisions needed
Scale:
• Hierarchical routing saves table size, reduced update
traffic
Performance:
• Intra-AS: can focus on performance
• Inter-AS: policy may dominate over performance
Outline
▪ IP routing
▪ Algorithms for routing protocols
• Link state
• Distance vector
• 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)
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
…. …. ....
Network Layer 4-43
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-44
Exercise - Distance-vector routing
Fig (a) is an existing RIB in router K and Fig (b) is an incoming
routing update message from router J.
a) How many items in update message cause a change in
router K’s RIB
b) What is router K’s RIB after the update?
45
RIP: link failure, recovery
o 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)
routed routed
transport transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
physical physical
• OSPF
OSPF (Open Shortest Path First)
• “open”: publicly available
• uses link state (LS) algorithm
– LS packet dissemination
– Each router constructs a complete topological map
– route computation using Dijkstra’s algorithm
• advertisements flooded to entire AS
– carried in OSPF messages directly over IP (rather than TCP or UDP
• IETF protocol
• Working group formed in 1988
• RFC 1247, RFC 2328
• OSPFv3 for IPv6: RFC 5340
51
OSPFv2: Components
52
OSPF packet format
• Each OSPFv2 message begins with a fixed 24-0ctet
header
53
OSPF packet
• IP Protocol #89
• Directly to neighbors using Multicast address ⇨ TTL 1
• Five packet types
– Hello
– Database Description
– Link State Request
– Link State Update
– Link State Acknowledgement
54
OSPFv2 Hello Message Format
• Hello Protocol
– Ensures that neighbors can send packets to and receive packets from the
other side: bi-directional communication
– Ensures that neighbors agree on parameters (HelloInterval
and RouterDeadInterval)
• How
– Hello packet to fixed
well-known multicast
address
– Periodic Hellos
– Broadcast network:
Electing designated
router (DR)
55
OSPFv2 Database Description Message Format
• Based on link-state
technology
– Local view of topology in a
database
• Database
– Consists of Link State
Advertisements (LSA)
– LSA: Data unit describing
local state of a network/router)
– Must be kept synchronized to react
to routing failures
56
OSPFv2 Database Description Message Format
• Identifying LSAs
– LS Type Field
– Link State ID Field
– Advertising Router Field
• Verifying LSA Contents
– LS Checksum Field
• Identifying LSA Instances (keeping
in mind that the topology changes)
– LS Sequence Number Field
• Linear sequence space
• Max Seq 🡪 new instance
• LS Age Field (to ensure consistency)
– Goal: new sequence number every 30
minutes
– Maximum value 1 hour; Age > 1 hour ⇨
invalid ⇨ removal
– Enables premature aging & ensures
removal of outdated information
58
OSPFv2 Link-status Request Message Format
• After exchanging database description with a neighbor, a router has
an initial description of a network
• However, a router may discover that part of it’s database is out of
date and want to request a neighbor to supply updated information
• To send periodic
broadcast messages
that specify the status
of directly connected
links
69
OSPF “advanced” features (not in RIP)
• security: all OSPF messages authenticated (to
prevent malicious intrusion)
• multiple same-cost paths allowed to be used (only
one path in RIP)
• integrated unicast and multicast support:
– Multicast OSPF (MOSPF) uses same topology
data base as OSPF
• hierarchical OSPF in large domains.