Professional Documents
Culture Documents
TN 206: Network Routers and Routing Protocols
TN 206: Network Routers and Routing Protocols
Routing Protocols
Routing Protocols
Autonomous System (AS)
An autonomous system is a region of the Internet that is
administered by a single entity.
Example: ISP.
Routing is done differently within an autonomous system
(intradomain routing) and between autonomous system
(interdomain routing).
Autonomous System (AS)
Ethernet Ethernet Autonomous
System 1
Router
Router Ethernet
Autonomous
Ethernet
Router System 2 RouterEthernet
Interdomain and Intradomain Routing
Interdomain Routing
Intradomain Routing
Routing between AS’s
Routing within an AS
Assumes that the Internet consists of
Ignores the Internet outside a collection of interconnected AS’s
the AS
Normally, there is one dedicated
Protocols for Intradomain router in each AS that handles
routing are also called interdomain traffic.
Interior Gateway Protocols
Protocols for interdomain routing are
or IGP’s.
also called Exterior Gateway
Popular protocols are Protocols or EGP’s.
RIP (simple, old) Routing protocols:
OSPF (better)
EGP
BGP (more recent)
4
Network as a Graph
c(v,w)
Net(v,w) w
v
Net
c(v,n) Net(v,n)
n
Distance Vector Algorithm: Routing Table
Net n D (v,Net)
[Net 1
,D(v,Net 1
)] [Net 1
,D(v,Net 1
)]
[Net N
,D(v,Net N
)] [Net N
,D(v,Net N
)]
m v w
[Net 1 ,D(v,Net 1)]
[Net N ,D(v,Net N )]
n
Initiating Routing Table I
Suppose a new node v becomes active.
The cost to access directly connected networks is zero:
D (v, Net(v,m)) = 0
D (v, Net(v,w)) = 0
D (v, Net(v,n)) = 0
RoutingTable
c(v,m) c (v,w) via
Net(v,m) Net(v,w) Dest cost
(next hop)
m v w
Net(v,m) m 0
c(v,n)
Net(v,n) Net(v,w) w 0
Net(v,n) n 0
n
Initiating Routing Table II
RoutingTable
Net(v,m) m 0
Net(v,w) w 0
Net(v,n) n 0
[Net(v,n),0]
[ n,0 ] [Net(v,n),0]
[ n,0 ]
[Net(v,w),0]
[w,0] [Net(v,m),0]
[m,0]
m
m v
v w
w
[m,0]
[Net(v,m),0]
[w,0][Net(v,w),0]
n
n
Initiating Routing Table III
[Net N ,D(n,Net N )]
n
Updating Routing Tables I
Suppose node v receives a message from node m: [Net,D(m,Net)]
[Net,D(m,Net)]
Net m v w
c(v,m)
Net(v,m)
Node v updates its routing table and sends out further messages if
the message reduces the cost of a route:
Net m v w
Net m D new
(v,Net)
c(v,m)
Net(v,m) [Net,D new (v,Net)]
n
Distance Vector Routing Protocols
Each node maintains a set of triples
<Destination, Cost, NextHop>
Exchange updates with neighbors
Periodically (seconds to minutes)
Whenever table changes (triggered update)
Each update is a list of pairs
<Destination, Cost>
Update local table if receive a “better” route
Smaller cost
Refresh existing routes, delete if time out
Assume: - link cost is 1, i.e., c(v,w) = 1
- all updates, updates occur simultaneously
Example: - Initially, each router only knows the cost of
connected interfaces
10.0.1.0/24 10.0.2.0/24 10.0.3.0/24 10.0.4.0/24 10.0.5.0/24
.2 .1 .2 .1 .2 .1 .2 .1
Router A Router B Router C Router D
cost
cost
cost
cost
Net via Net via Net via Net via
.2 .1 .2 .1 .2 .1 .2 .1
Router A Router B Router C Router D
cost
cost
cost
cost
Net via Net via Net via Net via
t=3: t=3:
t=3: t=3:
10.0.1.0 - 0 10.0.1.0 10.0.2.1 1 10.0.1.0 10.0.4.1 3
10.0.2.0 - 0 10.0.2.0 - 0 10.0.1.0 10.0.3.1 2
10.0.2.0 10.0.3.1 1 10.0.2.0 10.0.4.1 2
10.0.3.0 10.0.2.2 1 10.0.3.0 - 0 10.0.3.0 10.0.4.1 1
10.0.4.0 10.0.2.2 2 10.0.4.0 10.0.3.2 1 10.0.3.0 - 0
10.0.4.0 - 0 10.0.4.0 - 0
10.0.5.0 10.0.2.2 3 10.0.5.0 10.0.3.2 2
10.0.5.0 10.0.4.2 1 10.0.5.0 - 0
C 2 C oo
C - oo C A 3
C oo C 3
C B 4 C - oo
C 4 C oo
Count-to-Infinity
The reason for the count-to-infinity problem is that each
node only has a “next-hop-view”
For example, in the first step, A did not realize that its
route (with cost 2) to C went through node B
How can the Count-to-Infinity problem be solved?
Solution 1: Always advertise the entire path in an update
message (Path vectors)
If routing tables are large, the routing messages
require substantial bandwidth
BGP uses this solution
Count-to-Infinity
The reason for the count-to-infinity problem is that each
node only has a “next-hop-view”
For example, in the first step, A did not realize that its
route (with cost 2) to C went through node B
How can the Count-to-Infinity problem be solved?
Solution 2: Never advertise the cost to a neighbor if this
neighbor is the next hop on the current path (Split
Horizon)
Example: A would not send the first routing update to
B, since B is the next hop on A’s current route to C
Split Horizon does not solve count-to-infinity in all
cases!
Approaches to Shortest-Path Routing
There are two basic routing algorithms found on the Internet.
1. Distance Vector Routing
Each node knows the distance (=cost) to its directly connected neighbors
A node sends periodically a list of routing updates to its neighbors.
If all nodes update their distances, the routing tables eventually converge
New nodes advertise themselves to their neighbors
2. Link State Routing
Each node knows the distance to its neighbors
The distance information (=link state) is broadcast to all nodes in the
network
Each node calculates the routing tables independently
Distance Vector Routing Protocols
A router running a distance vector protocol does not know
the entire path to a destination; it only knows the distance
to the remote network and the direction, or vector. Its
knowledge comes through information from directly
connected neighbors.
Like all routing protocols, distance vector protocols use a
metric to determine the best route.
Distance vector protocols calculate the best route based on
the distance from a router to a network.
An example of a metric used is hop count, which is the
number of routers, or hops, between the router and the
destination.
Calculating the Best Path
Bellman-Ford equation
Let:
Da(b) denote the current best distance from a to b
c(a,b)denote the cost of a link from a to b
Then Dx(y) = minz(c(x,z) + Dz(y))
Routing messages contain D
D is any additive metric
e.g, number of hops, queue length, delay
log can convert multiplicative metric into an additive
one (e.g., probability of failure)
Distance Vector Routing Protocols
Distance vector protocols usually require less complicated
configurations and management than link-state protocols.
They can run on older, less powerful routers and require
lower amounts of memory and processing.
Routers using distance vector protocols broadcast or
multicast their entire routing table to their neighbors at
regular intervals.
If a router learns more than one route to a destination, it
calculates and advertises the route with the lowest metric.
Features of Distance Vector Routing Protocols
Periodic Updates: Updates to the routing tables are sent at
the end of a certain time period. A typical value is 90
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).
Route invalidation timers: Routing table entries are invalid
if they are not refreshed. A typical value is to invalidate an
entry if no update is received after 3-6 update periods.
Distance Vector Routing Protocols
This method of moving routing information through large
networks is slow.
At any given moment, some routers may not have the
most current information about the network. This limits
the scalability of the protocols and causes issues such as
routing loops.
Advantages: (a) Simple implementation and
maintenance (b) Low resource requirements
Disadvantages: (a) Slow convergence (b)Limited
scalability (c) Routing loops
Routing Information Protocol (RIP)
RIPv1 was the first and only IP routing protocol available
in the early days of networking.
RIPv1 does not send subnet mask information in its routing
updates and, therefore, does not support VLSM and CIDR.
RIPv1 automatically summarizes networks at the classful
boundary, treating all networks as though they were
default classes A, B, and C.
As long as networks are contiguous, such as 192.168.1.0,
192.168.2.0, and so on, this feature may not pose a serious
problem.
Routing Information Protocol (RIP)
RIPv1 was the first and only IP routing protocol available
in the early days of networking.
RIPv1 does not send subnet mask information in its routing
updates and, therefore, does not support VLSM and CIDR.
RIPv1 automatically summarizes networks at the classful
boundary, treating all networks as though they were
default classes A, B, and C.
As long as networks are contiguous, such as 192.168.1.0,
192.168.2.0, and so on, this feature may not pose a serious
problem.
Routing Information Protocol (RIP)
If the networks are discontiguous, for example if the
networks 192.168.1.0 and 192.168.2.0 are separated by
the network 10.0.1.0, RIPv1 may not correctly report the
routes.
By default, RIPv1 broadcasts its routing updates to all
connected routers every 30 seconds.
RIPv1 Packet Format
IP header UDP header RIP Message 1: RIPv1
1: request
2: response
Command Version Set to 00...0
2: for IP
address family Set to 00.00
0…0: request full rou-
ting table 32-bit address
(20 bytes)
one route entry
Address of destination
Unused (Set to 00...0)
32 bits
RIP v2
RIP v2 has many of the features of RIPv1. It also includes
important enhancements.
RIPv2 is a classless routing protocol that supports VLSM
and CIDR. A subnet mask field is included in v2 updates,
which allows the use of discontiguous networks.
RIPv2 also has the ability to turn off automatic
summarization of routes.
RIP v2
Both versions of RIP send their entire routing table out all
participating interfaces in updates.
RIP v1 broadcasts these updates to 255.255.255.255.
This requires all devices on a broadcast network like
Ethernet to process the data.
RIP v2 multicasts its updates to 224.0.0.9. Multicasts take
up less network bandwidth than broadcasts.
Devices that are not configured for RIPv2 discard
multicasts at the Data Link Layer.
RIP v2
Attackers often introduce invalid updates to trick a router
into sending data to the wrong destination or to seriously
degrade network performance.
Invalid information can also end up in the routing table
due to poor configuration or a malfunctioning router.
Encrypting routing information hides the content of the
routing table from any routers that do not possess the
password or authentication data.
RIPv2 has an authentication mechanism, whereas RIPv1
does not.
RIP v2
Although RIPv2 provides many enhancements, it is not an
entirely different protocol. RIPv2 shares many of the
features found in RIPv1, such as:
Hop-count metric
15-hop maximum
TTL equals 16 hops
Default 30-second update interval
Route poisoning, poison reverse, split horizon, and hold-downs to
avoid loops
Updates using UDP port 520
Administrative distance of 120
Message header containing up to 25 routes without authentication
RIP v2
When a router starts up, each RIP-configured interface sends
out a request message. This message requests that all RIP
neighbors send their complete routing tables.
RIP-enabled neighbors send a response message that includes
known network entries. The receiving router evaluates each
route entry based on the following criteria:
If a route entry is new, the receiving router installs the route in
the routing table.
If the route is already in the table and the entry comes from a
different source, the routing table replaces the existing entry if
the new entry has a better hop count.
If the route is already in the table and the entry comes from the
same source, it replaces the existing entry even if the metric is not
better.
RIP v2
The startup router then sends a triggered update out all
RIP-enabled interfaces containing its own routing table.
RIP neighbors are informed of any new routes.
As long as routers send and process the correct versions of
routing updates, RIPv1 and RIPv2 are completely
compatible. By default, RIPv2 sends and receives only
version 2 updates.
If a network must use both versions of RIP, the network
administrator configures RIPv2 to send and receive both
versions 1 and 2. By default, RIPv1 sends version 1
updates, but receives both versions 1 and 2.
RIP v2
Within an enterprise, it may be necessary to use both
versions of RIP. For example, part of the network may be
migrating to RIPv2, whereas another part may be staying
with RIPv1.
Overriding the global RIP configuration with interface-
specific behavior allows routers to support both versions
of RIP.
RIPv2 Packet Format
IP header UDP header RIP Message 2: RIPv2
1: request
2: response
Command Version Set to 00...0
2: for IP
address family Set to 00.00
0…0: request full rou-
ting table 32-bit address
(20 bytes)
one route entry
Address of destination
Unused (Set to 00...0)
32 bits
RIPv2 Packet Format
IP header UDP header RIPv2 Message 2: RIPv2
(20 bytes)
one route entry
Next-Hop IP address
Identifies a better next-hop
metric (1-16)
address on the same
subnet than the advertising
router, if one exists Up to 24 more routes (each 20 bytes)
(otherwise 0….0)
32 bits
RIP Security
Issue: Sending bogus routing updates to a router
RIPv1: No protection
RIPv2: Simple authentication scheme
IP header UDP header RIPv2 Message
2: plaintext
password
Command Version Set to 00.00
Password (Bytes 0 - 3)
Password (Bytes 4 - 7)
Authetication
Password (Bytes 8- 11)
32 bits
RIP Problems
When a route fails, RIP does not wait for the next periodic
update.
Instead, RIP sends an immediate update, called a
triggered update. It advertises the failed route by
increasing the metric to 16, effectively poisoning the route.
This update places the route in hold-down status while RIP
attempts to locate an alternate route with a better metric.
RIP Limitations
The RIP distance vector routing protocol is easy to
configure and requires minimal amounts of router
resources in order to function.
However, the simple hop count metric used by RIP is not
an accurate way to determine the best path in complex
networks. Additionally, the RIP limitation of 15 hops can
mark distant networks as unreachable.
RIP issues periodic updates of its routing table, which
consumes bandwidth, even when no network changes have
occurred. Routers must accept these updates and process
them to see if they contain updated route information.
RIP Limitations
Received Dijkstra’s
Link State Algorithm IP Routing
LSAs Database Table
link to M
o Calculate the shortest route in TENT
s source node.
M = {s};
for each n M
Dn = dsn;
while (M all nodes) do
Find w M for which Dw = min{Dj ; j M};
Add w to M;
for each n M
Dn = minw [ Dn, Dw + dwn ];
Update route;
enddo
Dijkstra’s LSR Algorithm
Consider the following network:
6 2
A B C 5
2 1 2
G
2 4
D E F 1
A B C D E F G
B 6 A 6 B 6 A 2 B 1 C 2 C 5
D 2 C 2 F 2 E 2 D 2 E 4 F 1
E 1 G 5 F 4 G 1
Dijkstra’s LSR Algorithm
Now, if we want to generate a PATH for C:
First, we add (C,0,0) to PATH
C (0)
Dijkstra’s LSR Algorithm
Examine C’s LSP
Add F, G, and B to TENT
C (0)
C (0)
(3) (6)
G
E
Dijkstra’s LSR Algorithm
G exists in TENT twice, keep only the best
The new G is a better path than the old (3 < 5)
C (0)
(3) (6)
G
E
Dijkstra’s LSR Algorithm
Put B into path (shown as solid line)
Add A and E to TENT
C (0)
(2) (2)
F B
C (0)
(2) (2)
F B
C (0)
(2) (2)
F B
(5)
D
Dijkstra’s LSR Algorithm
Place G in PATH (shown as solid line)
All G’s LSP elements already exist in TENT
C (0)
(2) (2)
F B
(5)
D
Dijkstra’s LSR Algorithm
Place D in PATH (shown as solid line)
Add path to A since it is better than old A
C (0)
(2) (2)
F B
(5)
D
(7)
A
Dijkstra’s LSR Algorithm
Place A in PATH (shown as solid line)
All A’s LSP elements already exist in PATH
C (0)
(2) (2)
F B
(3) (3)
G
E
(5)
D
(7)
A
Dijkstra’s LSR Algorithm
We are done since all routes from TENT were placed into
PATH
C (0)
(2) (2)
F B
(3) (3)
G
E
(5)
D
(7)
A
Dijkstra’s LSR Algorithm
We can now create a forwarding database:
Forwarding Database
C (0) Destination Port
(2) (2) C C
F B
F F
(3) (3)
G
E G F
B B
(5) E B
D
D B
(7)
A A B
LSR Topology Changes
LSR forwarding tables must be recalculated whenever a
topology change occurs
For example, a new router and/or link is added to the
network. This new link may provide a more efficient
route to one or more other nodes.
For example, a given link’s cost is reduce. This new
link may now provide the lowest total cost route to a
destination that was previously forwarded in another
direction.
For example, a given link’s cost is increased. This new
link may no longer provide the lowest total cost route
to a given destination, and another route should now be
chosen
LSR Topology Changes
C (0)
(2) (2)
F B
(3) (3)
G
E
(5)
D
(7)
A
Topology Change Example
Say we receive an LSP from router B, indicating the
link cost from B to E is now 6.
C (0)
(2) (2)
F B
(3) (3)
G
E
(5)
D
(7)
A
Topology Change Example
The total route costs are different in PATH:
C (0)
(2) (2)
F B
(3) (8)
G
E
(10)
D
(12)
A
Topology Change Example
Consider for now, only the cost to A
C (0)
(2) (2)
F B
(3) (8)
G
E
(10)
D
(12)
A
Topology Change Example
Recall that another path to A existed
Now, that path is more efficient
C (0)
(2) (2)
F B
(10)
D
(12)
A
Topology Change Example
The PATH data structure is complete, the forwarding
table can now be regenerated.
C (0)
(2) (2)
F B
(10)
D
Topology Change Example
D E F D E F D E F
If a node fails, each AA BB CC
node can calculate
the new route
network D E F
D E F
D E F
Link State Routing: Basic principles
1. Each router establishes a relationship (“adjacency”)
with its neighbors
2.Each router generates link state advertisements
(LSAs) which are distributed to all routers
LSA = (link id, state of the link, cost, neighbors of
the link)
3. Each router maintains a database of all received LSAs
(topological database or link state database), which
describes the network has a graph with weighted edges
4. Each router uses its link state database to run a shortest
path algorithm (Dijkstra’s algorithm) to produce the
shortest path to each network
OSPF
Open Shortest Path First (OSPF) is an example of a link-
state routing protocol.
10.1.3.0 / 24
10.1.6.0 / 24
independent of
interface addresses
.3 .5
.3 5 .5
.3 .5
10.1.5.0/24
Link costs are called Metric
10.10.10.2 10.10.10.5
Metric is in the range [0 , 216]
Metric can be asymmetric
Link State Advertisement (LSA)
10.10.10.1 10.10.10.2 10.10.10.4
10.1.3.0 / 24
10.1.6.0 / 24
Number of links: 3 = 2 links plus router itself .3 .5
.3 .5
.3 .5
10.1.5.0/24
Description of Link 1: Link ID = 10.1.1.1, Metric = 4
10.10.10.3 10.10.10.5
Description of Link 2: Link ID = 10.1.2.1, Metric = 3
Description of Link 3: Link ID = 10.10.10.1, Metric = 0
10.1.3.0 / 24
10.1.6.0 / 24
database which
contains the LSAs .3 .5
OSPF Message
Header
Body of OSPF Message
2: current version is
OSPF V2
version type message length ID of the Area from
Message types: source router IP address which the packet
originated
1: Hello (tests reachability)
Area ID
2: Database description
3: Link Status request checksum authentication type 0: no authentication
4: Link state update 1: Cleartext password
authentication 2: MD5 checksum
5: Link state acknowledgement (added to end packet)
authentication
Standard IP checksum taken
32 bits
over entire packet
Authentication passwd = 1: 64 cleartext password
Authentication passwd = 2: 0x0000 (16 bits)
KeyID (8 bits) Prevents replay
Length of MD5 checksum (8 bits) attacks
Nondecreasing sequence number (32 bits)
OSPF LSA Format
Link ID
Link ID
Scenario:
Router 10.1.10.2 restarts
OSPF Hello
ACK
ACK
LSA
LSA
LSA
AC A
LSA
A
ACK
LS
ACK
AC
K
K
LSA
Update ACK Update
database database
10.10.10.2 10.10.10.5
Dissemination of LSA-Update
A router sends and re-floods LSA-Updates, whenever the
topology or link cost changes. (If a received LSA does not
contain new information, the router will not flood the
packet)
Exception: Infrequently (every 30 minutes), a router will
flood LSAs even if there are not new changes.
Acknowledgements of LSA-updates:
explicit ACK, or
implicit via reception of an LSA-Update