CCN Module 4 - Routing Protocols
CCN Module 4 - Routing Protocols
1
OBJECTIVES:
❑ To introduce the idea of autonomous systems (ASs) that divide the
Internet into smaller administrative regions.
❑ To discuss the idea of distance vector routing and the RIP that is used
to implement the idea.
❑ To discuss the idea of link state routing as the second intra-AS
routing method and OSPF that is used to implement the idea.
❑ To discuss the idea of path vector routing as the dominant inter-AS
routing method and BGP that is used to implement the idea.
2
INTRODUCTION
3
Topics Discussed in the Section
✓ Cost or Metric (delay, throughput)
✓ Static versus Dynamic Routing Table:
• A static table is one with manual entries.
• A dynamic table, is updated automatically when
there is a change somewhere in the internet
✓ Routing Protocol
• A routing protocol is a combination of rules and
procedures that lets routers in the internet inform each
other of changes
• It allows routers to share whatever they know about the
internet or their neighborhood.
• Routing protocols can be either an interior protocol
(handles intradomain routing) or an exterior protocol
(interdomain routing). 4
INTER- AND INTRA-DOMAIN ROUTING
5
Autonomous systems
6
Popular routing protocols
8
A graph for Bellman-Ford algorithm
13
Step-2:Sharing of table with neighbours
14
Final routing tables of all routers
15
Example 2
Figure shows the initial routing table for an AS. Note that the
figure does not mean that all routing tables have been created
at the same time; each router creates its own routing table
when it is booted.
16
Example
17
Example
Now assume router A sends four records to its neighbors, routers B, D, and
C. Figure shows the changes in B’s routing table when it receives these
records.
a. When router B receives record 1, it searches its routing table for the
route to net1, and since it is not found there, it adds it to the table with
the next hop to be A.
b. When router B receives record 2, it searches its routing table and finds
the destination net2 there. However, since the announced cost plus 1 is
larger than the cost in the table, the record is discarded.
c. When router B receives record 3, it searches its router, and since Net4 is
not found, it is added to the table.
d. When router B receives record 4, it searches its router, and since Net5 is
not found, it is added to the table. Now router B has more information,
but it is not complete.
e. Router B does not even know that net7 exists. More updating is required
f. Each neighbouring router shares its routing table with B to complete the
routing table of B.
18
Example
4 3 2
Net5 , 1 Net4 , 1 Net2 , 1
19
Example
20
Count to Infinity problem
• For a routing protocol to work properly, if a link is broken
(cost becomes infinity), every other router should be aware
of it immediately, but in distance vector routing, this takes
some time.
• The problem is referred to as count to infinity. It takes
several updates before the cost for a broken link is
recorded as infinity by all routers.
21
Two-node instability
• When the link between
A and X fails. Node A
changes its table. If A
can send its table to B
immediately, everything
is fine.
• However, the system
becomes unstable if B
sends its routing table
to A before receiving A’s
routing table
• Packets bounce
between A and B,
creating a two-node
loop problem.
22
Solution to Two-Node Instability
Defining Infinity
Most implementations define 16 as infinity
Split Horizon: Never send routing information back in the
direction from which it was received.
Instead of flooding the table through each interface, each
node sends only part of its table through each interface
E.g. node B thinks that the optimum route to reach X is via
A, it does not need to advertise this piece of information
to A.
Taking information from node A, modifying it, and sending
it back to node A is what creates the confusion.
23
Solution to Two-Node Instability
Split Horizon with Poison Reverse
One drawback of Split Horizon
Normally, the DV protocol uses a timer and if there is
no news about a route, the node deletes the route
from its table
In the previous e.g., node A cannot guess that this is
due to split horizon or because B has not received any
news about X recently
Poison Reverse
Node B can still advertise the value for X, but is the
source of information is A, it can replace the distance
with infinity as a warning:“ Do not use this value; what
I know about this route comes from you.”
24
Three-node instability
Update loop
TCP/IP Protocol
until infinity Suite 25
Three-node instability
Suppose, after finding that X is not reachable, node A sends a packet to B and C to
inform them of the situation. Node B immediately updates its table, but the packet
to C is lost in the network and never reaches C. Node C remains in the dark and still
thinks that there is a route to X via A with a distance of 2. After a while, node C
sends its routing table to B, which includes the route to X. Node B is totally fooled
here. It receives information on the route to X from C, and according to the
algorithm, it updates its table showing the route to X via C with a cost of 3. This
information has come from C, not from A, so after awhile node B may advertise
this route to A. Now A is fooled and updates its table to show that A can reach X via
B with a cost of 4. Of course, the loop continues; now A advertises the route to X to
C, with increased cost, but not to B. C then advertises the route to B with an
increased cost. B does the same to A. And so on. The loop stops when the cost in
each node reaches infinity.
26
RIP
27
1. In an autonomous system, we are dealing with routers and
networks (links), what was described as a node.
2. The destination in a routing table is a network, which
means the first column defines a network address.
3. The metric used by RIP is very simple; the distance is
defined as the number of links (networks) that have to be
used to reach the destination. For this reason, the metric
in RIP is called a hop count.
4. Infinity is defined as 16, which means that any route in an
autonomous system using RIP cannot have more than 15
hops.
5. The next node column defines the address of the router to
which the packet is to be sent to reach its destination.
28
Example of a domain using RIP
29
Example
Figure shows the update message sent from router R1 to router
R2 . The message is sent out of interface 130.10.0.2.
The message is prepared with the combination of split
horizon and poison reverse strategy in mind. Router R1 has
obtained information about networks 195.2.4.0, 195.2.5.0, and
195.2.6.0 from router R2. When R1 sends an update message
to R2, it replaces the actual value of the hop counts for these
three networks with 16 (infinity) to prevent any confusion for R2.
The figure also shows the table extracted from the message.
Router R2 uses the source address of the IP datagram carrying
the RIP message from R1 (130.10.02) as the next hop address.
Router R2 also increments each hop count by 1 because the
values in the message are relative to R1, not R2.
30
Note
31
LINK STATE ROUTING
33
Link state knowledge
35
Step-1:Creation of LSP
LSP data: E.g. the node ID, the list of links, a sequence
number, and age/hop count.
• Node identity and the list of links, are needed to make
the topology.
• Sequence number, facilitates flooding and distinguishes
new LSPs from old ones.
• The age, prevents old LSPs from remaining in the
domain for a long time
36
LSP Generation
• When there is a change in the topology of the
domain
• On a periodic basis
There is no actual need for this type of LSP, normally
60 minutes or 2 hours
37
Step 2: Flooding of LSPs
Once a node has prepared an LSP, it must be disseminated
to all other nodes, not only to its neighbors. The process is
called flooding and based on the following:
1. The creating node sends a copy of the LSP out of each
interface.
2. A node that receives an LSP compares it with the copy it
may already have. If the newly arrived LSP is older than
the one it has (found by checking the sequence number),
it discards the LSP. If it is newer, the node does the
following:
a. It discards the old LSP and keeps the new one.
b. It sends a copy of it out of each interface except the
one from which the packet arrived. 38
Step 3: Formation of Shortest Path Tree: Dijkstra Algorithm
39
Step 3: Formation of Shortest Path Tree: Dijkstra Algorithm
The Dijkstra algorithm uses the following steps to create a shortest
path tree from a given graph:
1. Initialization: Select the node as the root of the tree and add it to
the path. Set the shortest distances for all the root’s neighbors to the
cost between the root and those neighbors. Set the shortest distance
of the root to zero.
2. Iteration: Repeat the following two steps until all nodes are added
to the path:
a. Adding the next node to the path: Search the nodes not in the
path. Select the one with minimum shortest distance and add it to
the path.
b. Updating: Update the shortest distance for all remaining nodes
using the shortest distance of the node just moved to the path in
step 2
Dj = minimum (Dj , Di + cij) for all remaining nodes
40
Dijkstra Algorithm
41
A-B-C=7
A-D=3
A-B-E=6
A-B=2
Permanent node : A, B,D
A-D=3
Temporary node : C,E
Permanent node : A, B
Temporary node : D
42
A-B-C=7
A-B-E-F=8
Permanent node : A, B, C, D, E
Temporary node : F, G
A-B-C=7
A-B-E=6
Permanent node : A, B, D, E
Temporary node : C, F
43
Permanent node : A, B, C, D, E ,F, G
Temporary node : --
A-B-C-G=10
A-B-E-F-G=9
Permanent node : A, B, C, D, E ,F
Temporary node : G
44
Continued
45
Step 4: Calculation of Routing Table from Shortest Path
Tree
46
Shortest path tree for each node as seen by node C
47