2. Routing Protocols
• Define how routers exchange network information
– What type of information
– The format of information exchange
– When to exchange
– Which router to exchange information with
• Examples
– Routing Information Protocol (RIP)
– Enhanced Interior Gateway Routing Protocol
(EIGRP)
– CISCO Proprietary
– Open Shortest Path First (OSPF)
– Border Gateway Protocol (BGP)
3. Routing Algorithms
Given a set of routers a
routing algorithm finds a
“Good” path from source
router to destination router
Least cost path
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
A graph is used to
formulate routing problems
A Graph G=(N,E) is a
Set of N nodes and a
collection E of edges
Nodes in the graph
represent Routers
Edges represent physical
links
3
2
2
1
packet’s header
0111
1
3 2
5. Graph Abstraction: costs
5
2
u
v
2
1
x
• c(x,x‟) = cost of link (x,x‟)
3
w
3
1
5
z
1
y
2
- e.g., c(w,z) = 5
• Cost can be
•Physical length of the link
•Delay etc.
Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
Question: What‟s the least-cost path between u and z ?
Routing algorithm: Algorithm that finds least-cost path
6. Routing Algorithm Classification
Global Routing Algorithm
Decentralized Routing
Algorithm
Computes least cost path
No node has complete
using complete global
knowledge about the
network.
Takes connectivity between
all nodes and all link costs
as input.
All routers have complete
topology, link cost
information
Also called “Link State”
Algorithms
Used by Open Shortest
Path First Protocol (OSPF)
information about the cost
of all links.
In the beginning knowledge
of its own directly attached
links.
Computes least cost path by
an iterative process of
calculation and exchange of
information.
Also called Distance Vector
(DV) Algorithm
Used by Routing Information
Protocol (RIP)
7. Link-State Routing Algorithm
Network topology and link
costs are known to all
nodes
Each node broadcast
link state packets to all
other nodes in the
network
Each link state packet
contains the identities
and cost of its attached
links
Dijkstra‟s Algorithm
Computes least cost paths
from one node („source”) to
all other nodes
Iterative: After k
iterations, least cost paths
to k destinations are known
Notation:
D(v): Current value of least
cost path from source to
destination (v).
p(v): Predecessor node along
path from source to v
N': Subset of nodes whose
least cost path is definitively
known
9. Dijkstra‟s Algorithm
5
1 Initialization:
3
v
w
2 N' = {u}
2
3 for all nodes v
u
2
1
4
if v is a neighbor of u
3
1
5
then D(v) = c(u,v)
x
y
1
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 each neighbor v of 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'
5
z
2