Routing-protocol-DC&CN 4.2
Routing-protocol-DC&CN 4.2
1
Router
A hardware device designed to
take incoming packets,
analyze the packets,
moving the packets to another network,
converting the packets to another network interface,
dropping the packets,
directing packets to the appropriate locations
2
A big WAN
3
What’s Routing
Routing - path finding from one end to the other
Routing occurs at layer 3
Network A Network B
4
IP Routing
IP performs:
search for a matching host address
search for a matching network address
search for a default entry
Routing done by IP router, when it searches the
routing table and decide which interface to end a
packet out.
incoming
which interface ?
5
Routing
Routing protocol
Goal: determine “good” path 5
(sequence of routers) thru
B 3 C
network from source to dest. 5
2
A 2 F
1
Graph abstraction for 1
3
D E 2
routing algorithms: 1
graph nodes are routers
graph edges are physical “good” path:
links typically means minimum
6
Routing Component
Three important routing elements :
algorithm
database
protocol
Algorithm : can be differentiate based on several
key characteristics
Database : table in routers or routing table
Protocol: the way information for routing to be
gathered and distributed
7
Routing Tables
Routing is carried out in a router by consulting
routing table.
No unique format for routing tables, typically table
contains:
address of a destination
IP address of next hop router
network interface to be used
subnet mask for the this interface
distance to the destination
8
Routing Algorithm
Design goals
Optimality - compute the best route
Simplicity/low overhead - efficient with a minimum
software and utilization overhead
Robustness/stability- perform correctly in the face
of unusual circumstances
Rapid convergence- responds quickly when the
network changes
Flexibility- accurate adapt to a variety of network
9
Routing Protocols
Routing protocol: protocol to exchange of
information between routers about the current
state of the network
Routing protocol jobs
create routing table entries
keep routing table up-to-date
compute the best choice for the next hop router
10
Routing Protocol Metrics
How do we decide that one route is better than another?
Metric: the determining factor used by a routing algorithm to
decide which route to a network is better than another
Examples of metrics:
Bandwidth - capacity
Delay - time
Load - amount of network traffic
Reliability - error rate
Hop count - number of routers that a packet must travel
through before reaching the destination network
Cost - arbitrary value defined by the protocol or
administrator
11
Hop Count
A hop is defined as a passage through one router
2 hops
1 hop 1 hop
R1 R2
1 hop 1 hop
R3
12
Routing Algorithms
Static routing
Calculated beforehand, offline
Default routing
“If I don’t recognize the destination, just send the packet
to Router X”
Dynamic routing protocol
Distance-vector algorithms
Link-state algorithms
Source routing Vs. Hop-by-hop
13
Routing Algorithm: Static Route
Manually configuration routing table
Can’t react dynamically to network change such as
router’s crash
Work well with small network or simple topology
point to point
connection
route to this
way only, no need
for update
14
Routing Algorithm: Static Technique
Flooding / Brute force routing
Every incoming packet is sent out every outgoing
Retransmit on all outgoing at each node
Simple technique, require no network information
Generate vast numbers of duplicate packet
flooding
incoming
15
Static Routing Example
172.16.20.1 172.16.20.2 172.16.40.1 172.16.40.2
e0 e0 e0
172.16.10.1 172.16.30.1 172.16.50.1
e0 e0 e0
172.16.10.1 172.16.30.1 172.16.50.1
18
Classification of routing protocols
19
Interior Versus Exterior Routing
Protocols
Interior routing protocols are used within an
autonomous system
Exterior routing protocols are used between
autonomous systems
Autonomous system (two definitions that are often used):
“A set of routers that presents a common routing policy to the
internetwork”
“A network or set of networks that are under the administrative control
of a single entity”
20
Distance Vector Routing Protocol
Distance means routing metric
Vector means destination
Flood routing table only to its neighbors
RIP is an example
Also known as Bellmann-Ford algorithm or Ford-
Fulkerson algorithm
21
Distance Vector Routing
Router maintains a routing table that lists known
networks, direction (vector) to each network, and the
distance to each network
Router periodically (every 30 seconds, for example)
transmits the routing table via a broadcast packet that
reaches all other routers on the local segments
Router updates the routing table, if necessary, based on
received broadcasts
22
Distance-Vector Routing Tables
23
Distance Vector Routing Algorithm
Distance Table data structure
each node has its own row for each
possible destination
column for each directly-attached
neighbor to node
example: in node X, for dest.Y via
neighbor Z:
distance from X to
X = Y, via Z as next hop
D (Y,Z)
= c(X,Z) + min {DZ(Y,w)}
w
24
Example: Distance Table for E
Column only for each neighbor
A 1 14 5 A A,1
B 7 8 5 B D,5
C 6 9 4 C D,4
D 4 11 2 D D,2
26
Distance Vector Algorithm:
At all nodes, X:
1 Initialization (don’t start knowing link costs for all links in graph):
2 for all adjacent nodes v:
3 D X(*,v) = infty /* the * operator means "for all rows" */
4 D X(v,v) = c(X,v)
5 for all destinations, y
6 send min D X(y,w) to each neighbor /* w over all X's neighbors */
w
27
Distance Vector Algorithm (cont.):
8 loop
9 wait (until I see a link cost change to neighbor V
10 or until I receive update from neighbor V)
11
12 if (c(X,V) changes by d)
13 /* change cost to all dest's via neighbor v by d */
14 /* note: d could be positive or negative */
15 for all destinations y: D X(y,V) = D X(y,V) + d
16
17 else if (update received from V wrt destination Y)
18 /* shortest path from V to some Y has changed */
19 /* V has sent a new value for its min DV(Y,w) */
w
20 /* call this received new value is "newval" */
21 for the single destination y: D X(Y,V) = c(X,V) + newval
22
23 if we have a new min DX(Y,w)for any destination Y
w
24 send new value of min D X(Y,w) to all neighbors
w
25
28 26 forever
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)}
node x table = min{2+1 , 7+0} = 3
cost to cost to
x y z x y z
x 0 2 7 x 0 2 3 X hears news from Y and Z
from
from
y ∞∞ ∞ y 2 0 1
z ∞∞ ∞ z 7 1 0
node y table
cost to
x y z y
2 1
x ∞ ∞ ∞
x z
from
y 2 0 1 7
z ∞∞ ∞
node z table To start just know directly connected
cost to links…tell neighbors
x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
29
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 table = min{2+1 , 7+0} = 3
cost to cost to cost to
x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from
from
from
y ∞∞ ∞ y 2 0 1 y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
node y table
cost to cost to cost to
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
from
y 2 0 1 y 2 0 1 y 2 0 1 7
z ∞∞ ∞ z 7 1 0 z 3 1 0
node z table In steady
cost to cost to cost to
state, when
x y z x y z x y z have good
x ∞∞ ∞ x 0 2 7 x 0 2 3 news tell
from
from
neighbor
from
y ∞∞ ∞ y 2 0 1 y 2 0 1
z 7 1 0 z 3 1 0 z 3 1 0
time
30
Distance Vector Routing Update
Step by step from router to router
Slow convergence
• •
recompute R1’s recompute R2’s recompute R3’s
routing table routing table routing table
Œ
topology
R1 R2 R3 change
31
Distance Vector: Broadcast (I)
The first round
I, 1 hop
R1 J, 1 hop
J, 1 hop
K, 1 hop
J M, 1 hop
I
N, 1 hop
R3
K
R2 N, 1 hop
O, 1 hop
I, 1 hop
L N
K, 1 hop R5
M
L, 1 hop
O
R4
L, 1 hop
M, 1 hop
O 1 hop
32
Distance Vector: Broadcast (II)
The second round I, 1 hop
J, 1 hop
K, 2 hops J, 1 hop
R1 L, 2 hops K, 1 hop
M, 2 hops M, 1 hop
N, 2 hops N, 1 hop
I, 2 hops N, 1 hop
J L, 2 hops O, 1 hop
I O, 2 hops J, 2 hops
R3 K, 2 hops
K M, 1 hop
R2 L, 2 hops
I, 1 hop L N
R5
K, 1 hop M
L, 1 hop
J, 2 hops O
M, 2 hops
N, 2 hops R4
O, 2 hops L, 1 hop
M, 1 hop
O, 1 hop
I, 2 hops
K, 2 hops
J, 2 hops
N, 2 hops
33
Distance Vector: Broadcast (III)
The third round I, 1 hop
J, 1 hop
K, 2 hops
L, 2 hops J, 1 hop
R1 K, 1 hop
M, 2 hops
N, 2 hops M, 1 hop
O, 3 hops N, 1 hop N, 1 hop
I, 2 hops O, 1 hop
J L, 2 hops
I J, 2 hops
O, 2 hops K, 2 hops
R3
K M, 1 hop
R2 L, 2 hops
I, 3 hops
I, 1 hop
L N
K, 1 hop R5
M
L, 1 hop
J, 2 hops O
M, 2 hops
N, 2 hops
O, 2 hops R4
L, 1 hop
M, 1 hop
O, 1 hop
I, 2 hops
K, 2 hops
J, 2 hops
N, 2 hops
34
Distance Vector: Crashed Recovery
R3 crashed R1
35
Routing Information Protocol (RIP)
First standard routing protocol developed for TCP/IP
environments
RIP Version 1 is documented in RFC 1058 (1988)
RIP Version 2 is documented in RFC 2453 (1998)
Easy to configure and troubleshoot
Broadcasts its routing table every 30 seconds; 25 routes per
packet
Uses a single routing metric (hop count) to measure the
distance to a destination network; max hop count is 15
36
RIP V2 Features
Includes the subnet mask with route updates
Supports prefix routing (classless routing, supernetting)
Supports variable-length subnet masking (VLSM)
37
IGRP Solved Problems with RIP
15-hop limitation in RIP
IGRP supports 255 hops
38
EIGRP
Adjusts to changes in internetwork very quickly
Incremental updates contain only changes, not full
routing table
Updates are delivered reliably
Router keeps track of neighbors’ routing tables and
uses them as feasible successor
Same metric as IGRP, but more granularity (32 bits
instead of 24 bits)
39
Link-State Routing
Routers send updates only when there’s a change
Router that detects change creates a link-state
advertisement (LSA) and sends it to neighbors
Neighbors propagate the change to their neighbors
Routers update their topological database if necessary
40
Open Shortest Path First (OSPF)
Open standard, defined in RFC 2328
Adjusts to changes quickly
Supports very large internetworks
Does not use a lot of bandwidth
Authenticates protocol exchanges to meet security
goals
41
IS-IS
Intermediate System-to-Intermediate System
Link-state routing protocol
Designed by the ISO for the OSI protocols
Integrated IS-IS handles IP also
42
Path vector routing table
43
Border Gateway Protocol (BGP)
Allows routers in different autonomous systems to
exchange routing information
Exterior routing protocol
Used on the Internet among large ISPs and major companies
Supports route aggregation
Main metric is the length of the list of autonomous
system numbers, but BGP also supports routing based on
policies
44
Routing Algorithm: Source Routing
Source routing
Source will determine the entire route
Routers only act as store-forward devices
Hop-by-hop
Routers determine the path based on theirs own
calculation
45