0% found this document useful (0 votes)
9 views61 pages

04 - Intra-Domain Routing

The document outlines the concepts and algorithms related to intra-domain routing in computer networking, focusing on routing protocols such as RIP and OSPF. It discusses the differences between link state and distance vector algorithms, detailing how routing tables are constructed and maintained. The document also explains the processes involved in IP routing, including the discovery of paths, maintenance of routing tables, and packet forwarding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views61 pages

04 - Intra-Domain Routing

The document outlines the concepts and algorithms related to intra-domain routing in computer networking, focusing on routing protocols such as RIP and OSPF. It discusses the differences between link state and distance vector algorithms, detailing how routing tables are constructed and maintained. The document also explains the processes involved in IP routing, including the discovery of paths, maintenance of routing tables, and packet forwarding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Kwame Nkrumah University of

Science & Technology, Kumasi, Ghana

COE 475 – Computer Networking


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

▪ Algorithms used for routing protocols


▪ Link state
▪ Distance vector

▪ Understand the use of intra-domain routing protocols


▪ RIP
▪ OSPF (Open Shortest Path First)

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

What is IP routing? Network Layer

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

Routing protocol goal: Determine “good” paths through


the network local forwarding table
header value output link

▪ Path: Sequence of routers that packets will traverse 0100


0101
3
2
0111 2
▪ “Good”: least “cost”, “fastest”, “least congested” 1001 1

▪ Must avoid loops


▪ Convergence: How fast do the routers react on topology
0111
changes
▪ Overhead of routing traffic: CPU, memory, bandwidth
▪ Routing algorithm scalability defines their suitability
for large networks
▪ Routing: a top networking challenge!
Routing table
▪ A routing table must contain at least two pieces of information:
• the destination network and
• the next hop toward that destination
▪ This reflects a fundamental paradigm of IP routing: hop-by-hop
routing
▪ In other words, only the next hop to reach the destination is known
▪ Routes (installed in the routing table) are learned
through the following mechanisms:
routing algorithm
• directly connected networks,
• static routes, and local forwarding
table
• dynamic routing protocols header value output
link
0100 3
0101 2
0111 2
1001 1
Directly connected networks
▪ A directly connected network is a
network that is directly attached to one
of the router’s interfaces
▪ Directly attached networks are
immediately accessible
▪ Donot require any specific routing
mechanism to discover
▪ The moment these networks are
connected to the router they are visible
in R ’s routing table
Router R with its directly connected
▪ Directly connected networks are
networks 1.0.0.0, 10.1.1.0, and 10.1.2.0
automatically installed in the routing
table if the interface to the network is up
Static routing
▪ Static routing is a form of routing that
occurs when a router uses a manually-
configured routing entry
▪ Static routes must be configured on all
routers that need a route
▪ Every new network requires a new
static route
▪ Does not scale well
ip route network [mask]
{address|interface} [distance] ip route 146.1.0.0 255.255.0.0 1.1.1.2
To get to network 146.1.0.0/16, go to the next hop of 1.1.1.2
Static routing
▪ If 1.1.1.2 goes down, an
alternate path - shown via R2 -
cannot be used until a second
static route is specified
▪ Static routes are smart to the
extent that if the next hop
specified (interface or IP address)
goes down, the router will
remove the static route entry
from the routing table
Dynamic routing
▪ Dynamic routing protocols allow each
router to automatically discover one
or more paths to each destination in
the network
▪ When the network topology changes,
it automatically adjust the contents of
the routing table to reflect the new
network topology
▪ Dynamic routing relies on (frequent!)
updates to discover changes in
network topology

When a new path is added, it can be automatically discovered by a


routing protocol such as RIP, EIGRP or OSPF
Learn a route via multiple sources
Question: What if a route is learnt via
multiple sources, via OSPF and as a
static entry?
▪ Each source of routing information has
an attached measure of its
trustworthiness, called administrative
distance. The lower the administrative
distance, the more trustworthy the
source.
▪ The static entry, not the entry known via
OSPF, will be installed in the routing
table
▪ Considered internally within a router;
not exchanged in routing updates
Three key sets of processes running on each
router that make up IP routing
1. Processes associated with the discovery of paths to various
destinations in the network
• dynamic routing protocols as well as static route entries
2. Processes that maintain the IP routing table
• receive updates from all dynamic routing protocols running on
the router as well as from static route entries
• Administrative distance
3. Processes involved with the forwarding of IP packets.
• Match between the destination IP address in the packet and the
contents of the IP routing table
• Longest prefix match
Outline
▪ IP routing
▪ Algorithms for routing protocols
• Link state
• Distance vector

▪ Interconnected autonomous systems


▪ Intra-domain routing
• OSPF

• 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

The dynamic routing protocols are based on two algorithms


i.e., link state and 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

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


?
routing algorithm: algorithm that finds that least cost
path Network Layer 16
A Link-State Routing Algorithm
• Tell everyone what you know about your neighbors
• First, each router constructs its own topological map
of the entire network, based on updates from
neighbors
• Next, each router uses Dijkstra’s algorithm to
compute the shortest path to each destination in this
graph
A Link-State Routing Algorithm
Dijkstra’s algorithm notation:
• net topology, link costs • c(x,y): link cost from node
known to all nodes x to y; = ∞ if not direct
– accomplished via “link state neighbors
broadcast” • D(v): current value of cost
– all nodes have same info of path from source to dest.
• computes least cost paths v
from one node (‘source”) • p(v): predecessor node
to all other nodes along path from source to v
– gives forwarding table for • N': set of nodes whose
that node least cost path definitively
• iterative: after k known
iterations, know least cost
path to k dest.’s
Network Layer 19
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 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

▪ Interconnected autonomous systems


▪ Intra-domain routing
• OSPF

• 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

cost from neighbor v to destination y


cost to neighbor v
min taken over all neighbors v of x
Network Layer 4-25
Bellman-Ford example : from u to z
5

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

node achieving minimum is next hop in shortest


path, used in forwarding table
Network Layer 26
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-27


Distance vector algorithm
iterative, asynchronous: each
each local iteration node:
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 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

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 31
Slow convergence problem

❖ In (a), three routers have a route to network 1 using distance-vector


protocol
• To reach network 1, R3 forwards to R2, and R2 forwards to R1
❖ In (b), the connection to network 1 has failed.
• R1 detects the loss of connectivity and removes the route to network 1
from it’s RIB
• R1 sets distance to network 1 as infinity
❖ In the same instance, assuming R2 broadcasts route to network 1 at a
distance 2,
• R1 receives this broadcast route, and adds a new route to network 1
through R2 at a distance of 3.
Slow convergence problem

❖ In (c), routing loop occurs, caused because R2 advertises a route to network 1


• R1 has installed a route to network 1 that goes through R2, and R2 has
route to network 1 that goes through R1
• If R1 and R2 receive a datagram destined for network 1, they will route the
datagram back and forth until the hop limit is reached.

bad news travels slow - “count to infinity” problem!


Solving the slow convergence problen
Split horizon update:
❖ A router does not propagate information about a route back
over the same interface from which the route arrived.

poison reverse combined with triggered updates:


❖ poison reverse is a loop avoidance method
❖ Once a connection disappears, the router advertising the
connection will include an infinite cost route in its broadcast to
its neighbours
❖ Triggered updates forces a router to broadcast routing
information update immediately after receiving bad news

34
Outline
▪ IP routing
▪ Algorithms for routing protocols
• Link state
• Distance vector

▪ Interconnected autonomous systems


▪ Intra-domain routing
• OSPF

• RIP
Making routing scalable: Hierarchical routing
our routing study thus far - idealization
❖ all routers identical
❖ network “flat”
… not true in practice

scale: with 600 million 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 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

▪ Interconnected autonomous systems


▪ Intra-domain routing
• RIP

• 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
A B w u 1
v 2
w 2
x
C D x 3
z
y y 3
z 2

Network Layer 4-42


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
…. …. ....
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)

Network Layer 4-47


RIP table processing
❖ RIP routing tables managed by application-level
process called routed (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-48


Outline
▪ IP routing
▪ Algorithms for routing protocols
• Link state
• Distance vector

▪ Interconnected autonomous systems


▪ Intra-domain routing
• RIP

• 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

Network Layer 4-50


Routing tasks: OSPF
• Neighbor
– Discovery
– Maintenance
• Database
– Granularity
– Maintenance – updates
– Synchronization
• Routing table
– Metric
– Calculation
– Update

51
OSPFv2: Components

• Hello Protocol: “Who is my neighbor?”


• Database Synch: “What info am I missing?”
• Reliable flooding alg: “How do I distribute info?”
• Designated router/Backup designated router (DR/BDR) election: “Don’t
flood to all neighbors … with whom do I want to talk?”
• Route computation
– From link state database
– Using Dijkstra’s algorithm
– Supporting equal-cost path routing

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

A router sends the message to a neighbor to request current


information about a specific set of links
59
OSPFv2 Link-status Update Message Format

• To send periodic
broadcast messages
that specify the status
of directly connected
links

• The format of the link-


status advertisement
used in the link-status
message
60
Designated router election
• When router joins:
– Listen to hellos; if DR and BDR advertised, accept them
• All Hello packets agree on who the DR and BDR are
• Status quo is not disturbed
• If there is no elected BDR, router with highest priority becomes
BDR
• Ties are broken by highest RouterID
– RouterIDs are unique (IP address of interface)
• If there is no DR, BDR is promoted to DR
• Elect new BDR

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.

Network Layer 4-71


Hierarchical OSPF
• Two-level hierarchy:
local area and
backbone.
– Link-state advertisements do
not leave respective areas.
– Nodes in each area have detailed
area topology; they only know
direction (shortest path) to
networks in other areas.

• Area Border routers: “summarize” distances


to networks in the area and advertise them to other Area Border
routers.
• Backbone routers: run an OSPF routing algorithm limited to the
backbone.
• Boundary routers: connect to other ASs.
72
Areas
• An AS (or Routing Domain) is divided into areas (group of
routers “close” to each other)
– Reduce the extend of LSA flooding
– OSPF requires a backbone area (Area 0)
• Routing between areas only via backbone area
• Strict area hierarchy (no loops allowed)
– Different LSAs for Intra-area links, Inter-area links, Stub-networks,
External routes injected from a different AS
• Link and router failures can cause areas to be partitioned
– Some partitions are healed automatically
– Some need manual intervention (Virtual Links)
– Isolated area: Link failure results in no path to the rest of the
network
• Obviously, cannot be healed at all
• Redundancy is important!
OSPF: Summary

• Neighbors Multicast group


– Discovery Hello protocol
– Maintenance

• Database Link state advertisements (LSA)


– Granularity
LSA-updates flooding protocol
– Maintenance
Synchronization protocol
– Synchronization
Fixed values
• Routing table Local shortest path
– Metric calculation
– Calculation
7
4

You might also like