Unit 3 - Dynamic Routing
Unit 3 - Dynamic Routing
Basic routing
Levels of abstraction
Partitioning: AS and areas
Autonomous systems- RFC1930
Simple internet architecture
Reachability and metrics
IP aggregation
Redistribution of routing information
Load balancing
Popular routing protocols
Distance vector
RIP(Routing Information Protocol),
RIP problem (count to infinity),
Solution (Triggered Update, split horizon, poison reserve, and hold
down))
Disadvantage with RIP.
Link State Protocols
Dijkstra algorithm (shortest path first)
Overview of OSPF
OSPF Network Topology
OSPF protocols (hello, exchange, flooding)
Distribution of link state advertisement
IS-IS
Path vector
Overview of path vector
BGP (overview and architecture)
BGP router model
Routing
Routing is the process of selecting path along which the data can be transferred from
source to the destination. Routing is performed by a special device known as a router.
A Router works at the network layer (layer 3) in the OSI model and internet layer in
TCP/IP model
A router is a networking device that forwards the packet based on the network layer
information available in the packet header and forwarding table.
The routing algorithms/protocols are used for routing the packets. The routing protocol
is nothing but a software responsible for deciding the optimal path through which
packet can be transmitted.
The routing protocols use the metric to determine the best path for the packet delivery.
The metric is the standard of measurement such as hop count, bandwidth, delay, current
load on the path, etc. used by the routing algorithm to determine the optimal path to the
destination.
The routing algorithm initializes and maintains the routing table for the process of path
determination.
Routing Types
Static Routing
Static Routing is also known as Nonadaptive Routing.
It is a technique in which the administrator manually adds the routes in a routing table.
A Router can send the packets for the destination along the route defined by the
administrator.
In this technique, routing decisions are not made based on the condition or topology of
the networks
Default Routing
Default Routing is a special case of Static Routing
Default Routing is a technique in which a router is configured to send all the packets to
the same hop device, and it doesn't matter whether it belongs to a particular network or
not. A Packet is transmitted to the device for which it is configured in default routing.
Default Routing is used when networks deal with the single exit point.
It is also useful when the bulk of transmission networks have to transmit the data to the
same device.
When a specific route is mentioned in the routing table, the router will choose the
specific route rather than the default route. The default route is chosen only when a
specific route is not mentioned in the routing table
Dynamic Routing
It is also known as Adaptive Routing.
It is a technique in which a router adds a new route in the routing table for each packet
in response to the changes in the condition or topology of the network.
Dynamic protocols are used to discover the new routes to reach the destination.
If any route goes down, then the automatic adjustment will be made to reach the
destination.
Homework
1. Compare between static and dynamic routing.
Distance Vector Routing Protocol
RIP Versions
RIP has two versions, Version 1 (RIPv1) and Version 2 (RIPv2).
RIPv1 (RFC 1058) is classfull, and thus does not include the subnet mask with its
routing table updates. Because of this, RIPv1 does not support Variable Length Subnet
Masks (VLSMs). RIPv1 sends updates as broadcasts to address 255.255.255.255.
RIPv2 (RFC 2543) is classless, and thus does include the subnet mask with its routing
table updates. RIPv2 fully supports VLSMs, allowing discontiguous networks and
varying subnet masks to exist. Other enhancements offered by RIPv2 include:
• Routing updates are sent via multicast, using address 224.0.0.9
• Encrypted authentication can be configured between RIPv2 routers
Count to Infinity Problem in RIP
Let’s assume no loop avoidance mechanisms are configured on either router. If the
172.18.0.0 network fails, Router B will send out an update to Router A within 30 seconds
(whenever its update timer expires) stating that route is unreachable (metric = 16).
But what if an update from Router A reaches Router B before this can happen? Router
A believes it can reach the 172.18.0.0 network in one hop (through Router B). This will cause
Router B to believe it can reach the failed 172.18.0.0 network in two hops, through Router A.
Both routers will continue to increment the metric for the network until they reach a hop
count of 16, which is unreachable. This behaviour is known as count to infinity and is an
undesired event.
How can we tackle this problem? There are several loop avoidance mechanisms:
Split-Horizon
It prevents a routing update from being sent out the interface it was received on. In
other words, routers do not report information back to the router from which their
information originated.
In our above example, split-horizon would prevent Router A from sending an update
for the 172.18.0.0 network back to Router B, as it originally learned the route from
Router B. Split-horizon is enabled by default on most of the Routers.
Poison Reverse + Split Horizon
In case of a failed link it advertises the reverse routes with a metric of 16 (i.e.
unreachable). When learning of a failed route, it suspends split-horizon rules for that
route, and advertises a poisoned route. It does not add information but helps to break
the loop faster.
Route-Poisoning / Triggered Update
It triggers an automatic update for the failed network, without waiting for the update
timer to expire. This update is sent out all interfaces with an infinite metric (hop-count
16) for that network.
Hold-Down Timers
Prevents RIP from accepting any new updates for routes in a hold-down state, until
the hold-down timer expires. If Router A sends an update to Router B with a higher
metric than what is currently in Router B’s routing table, that route will be placed in a
hold-down state. (Router A’s metric for the 172.18.0.0 network is 1; while Router B’s
metric is 0).
Advantages of RIP
• Easy to understand and configure
• Supports load balancing
• Usually Loop Free
• Supported by most of the routers.
Disadvantages of RIP
• Inefficient (consumes significant bandwidth as whole routing table is exchanged)
• Not suitable for larger network (i.e. max hop count =15)
• Slow convergence.
• Support only equal-cost load balancing (Pinhole congestion)
• The smallest hop may not be the fastest route as it doesn’t consider bandwidth of link.
Convergence in RIP (*for explanation only)
Fig 1: Initial
Routing Table
Before exchange of
RIP updates
Based on this topology, a listing of the different updates that R1, R2, and R3 send and receive during initial
convergence is provided
R1:
Sends an update about network 10.1.0.0 out the Serial 0/0/0 interface
Sends an update about network 10.2.0.0 out the FastEthernet 0/0 interface
Receives update from R2 about network 10.3.0.0 and increments the hop count by 1
Stores network 10.3.0.0 in the routing table via Serial 0/0/0 with a metric of 1
R2:
Sends an update about network 10.3.0.0 out the Serial 0/0/0 interface
Sends an update about network 10.2.0.0 out the Serial 0/0/1 interface
Receives an update from R1 about network 10.1.0.0 and increments the hop count by 1
Stores network 10.1.0.0 in the routing table via Serial 0/0/0 with a metric of 1
Receives an update from R3 about network 10.4.0.0 and increments the hop count by 1
Stores network 10.4.0.0 in the routing table via Serial 0/0/1 with a metric of 1
R3:
Sends an update about network 10.4.0.0 out the Serial 0/0/1 interface
Sends an update about network 10.3.0.0 out the FastEthernet 0/0 interface
Receives an update from R2 about network 10.2.0.0 and increments the hop count by 1
Stores network 10.2.0.0 in the routing table via Serial 0/0/1 with a metric of 1
Fig 2: Routing
Table after Initial
Exchange
After this first round of update exchanges, each router knows about the connected networks of its
directly connected neighbors. However, did you notice that R1 does not yet know about 10.4.0.0 and that R3
does not yet know about 10.1.0.0? Full knowledge and a converged network do not take place until there is
another exchange of routing information.
After initial discovery is complete, each router continues the convergence process by sending and
receiving the following updates.
R1:
Sends an update about network 10.1.0.0 out the Serial 0/0/0 interface
Sends an update about networks 10.2.0.0 and 10.3.0.0 out the FastEthernet 0/0 interface
Receives an update from R2 about network 10.4.0.0 and increments the hop count by 1
Stores network 10.4.0.0 in the routing table via Serial 0/0/0 with a metric of 2
Same update from R2 contains information about network 10.3.0.0 with a metric of 1. There is no
change; therefore, the routing information remains the same.
R2:
Sends an update about networks 10.3.0.0 and 10.4.0.0 out of Serial 0/0/0 interface
Sends an update about networks 10.1.0.0 and 10.2.0.0 out of Serial 0/0/1 interface
Receives an update from R1 about network 10.1.0.0. There is no change; therefore, the routing
information remains the same.
Receives an update from R3 about network 10.4.0.0. There is no change; therefore, the routing
information remains the same.
R3:
Sends an update about network 10.4.0.0 out the Serial 0/0/1 interface
Sends an update about networks 10.2.0.0 and 10.3.0.0 out the FastEthernet 0/0 interface
Receives an update from R2 about network 10.1.0.0 and increments the hop count by 1
Stores network 10.1.0.0 in the routing table via Serial 0/0/1 with a metric of 2
Same update from R2 contains information about network 10.2.0.0 with a metric of 1. There is no
change; therefore, the routing information remains the same.
Fig 3: Routing
Table After
Convergence
RIP Timers(*for explanation only)
RIP has four basic timers:
1. Update Timer (default 30 seconds) – indicates how often the router will send out a routing table
update.
2. Invalid Timer (default 180 seconds) – indicates how long a route will remain in a routing table
before being marked as invalid, if no new updates are heard about this route.
The invalid timer will be reset if an update is received for that particular route before the
timer expires. A route marked as invalid is not immediately removed from the routing table.
Instead, the route is marked (and advertised) with a metric of 16, indicating it is unreachable, and
placed in a hold-down state.
3. Hold-down Timer (default 180 seconds) – indicates how long RIP will “suppress” a route that it
has placed in a hold-down state. RIP will not accept any new updates for routes in a hold-down
state, until the hold-down timer expires. A route will enter a hold-down state for one of three
reasons:
• The invalid timer has expired.
• An update has been received from another router, marking that route with a metric of 16 (or
unreachable).
• An update has been received from another router, marking that route with a higher metric
than what is currently in the routing table. This is to prevent loops.
4. Flush Timer (default 240 seconds) – indicates how long a route can remain in a routing table
before being flushed, if no new updates are heard about this route. The flush timer runs
concurrently with the invalid timer, and thus will flush out a route 60 seconds after it has been
marked invalid.
Note: RIP timers must be identical on all routers on the RIP network, otherwise massive instability
will occur.
Administrative Distance
Administrative Distance (AD) is a value that routers use in order to select the best path when
there are two or more different routes to the same destination from two different routing protocols.
Administrative Distance counts the reliability of a routing protocol. Administrative Distance (AD) is a
numeric value which can range from 0 to 255. A smaller Administrative Distance (AD) is more trusted
by a router, therefore the best Administrative Distance (AD) being 0 and the worst, 255.
Iteration 2:
Since the smallest value is in 2nd row is 2 (for both B and E), we can mark any of them, and
for this example we mark B and also mark its value 2.
The vertices which are directly connected with B are A, C and D. But A is already marked, so
we will not choose A. Hence, update new destination values of C &D.
New Destination value = minimum (Old Destination value, Marked value+ Edge Weight)
New Value of C = min (∞, 2+2) = 4
Marke A B C D E F
New Value of D = min (3, 2+4) = 3
d
Others value remain same.
A 0 ∞ ∞ ∞ ∞ ∞
B 2 ∞ 3 2 ∞
4 3 2 ∞
Table: After iteration 2.
Iteration 3:
Since the smallest value in 3rd row is 2 (for E), we mark E and also mark its value 2.
The vertices which are directly connected with E are A and F. But A is already marked, so we
will not choose A. Hence, update new destination value of F.
New Destination value = minimum (Old Destination value, Marked value+ Edge Weight)
New Value of F = min (∞, 2+3) = 5
Marke A B C D E F
Others value remain same.
d
A 0 ∞ ∞ ∞ ∞ ∞
B 2 ∞ 3 2 ∞
E 4 3 2 ∞
4 3 5
Table: After iteration 3.
Iteration 4:
Since the smallest value in 4th row is 3 (for D), we mark D and also mark its value 3.
The vertices which are directly connected with D are A, B, C & F. But A & B are already
marked, so we will not choose A & B. Hence, update new destination value of C & F.
New Destination value = minimum (Old Destination value, Marked value+ Edge Weight)
New Value of C = min (4, 3+2) = 4
New Value of F = min (5, 4+3) = 5
Marke A B C D E F
Others value remain same.
d
A 0 ∞ ∞ ∞ ∞ ∞
B 2 ∞ 3 2 ∞
E 4 3 2 ∞
D 4 3 5
4 5
Table: After
iteration 4.
Iteration 5:
Since the smallest value in 5th row is 4 (for C), we mark C and also mark its value 4.
The vertices which are directly connected with C are B, D & F. But B & D are already
marked, so we will not choose B & D. Hence, update the new destination value of F.
New Destination value = minimum (Old Destination value, Marked value+ Edge Weight)
New Value of F = min (5, 4+2) = 5
Others value remain same.
Marke A B C D E F
d
A 0 ∞ ∞ ∞ ∞ ∞
B 2 ∞ 3 2 ∞
E 4 3 2 ∞
D 4 3 5
C 4 5
5
Iteration 6:
As there is only one unmarked vertex remaining i.e. F. So, we mark F and its value 5.
Marke A B C D E F
d
A 0 ∞ ∞ ∞ ∞ ∞
B 2 ∞ 3 2 ∞
E 4 3 2 ∞
D 4 3 5
C 4 5
F 5
Table:
After iteration 6.
Since, all the vertices are marked. Step 3 is over.
Step 4: Find the shortest path from source to destination using backtracking.
Put destination vertex in ‘shortest path’
i. Set pointer to the last marked value and put that vertex to the ‘shortest path’ list.
ii. Move the pointer up until marked value is change.
iii. If the last marked value has been changed then move the pointer to the marked value in
that row and put that vertex to the ‘shortest path’ list.
Repeat (ii) and (iii) until the pointer will move to source vertex.
The last marked value is 5 so put F to the ‘shortest path’ list. Shortest path: F
Now, move the pointer up, the value is same. So again move the pointer up again, the value is
same. So again move the pointer, the value has changed (infinity). So now, move the pointer
to the marked value in that row which is 2 and put the vertex E to the ‘shortest path’ list.
Shortest path: F -> E
Now again, Move the pointer up, the value is same. So again move the pointer up again, the
value has changed (infinity). So now, move the pointer to the marked value in that row which
is 0 and put the vertex A to the ‘shortest path’ list.
Shortest path: F -> E -> A
And, the minimum cost from A to F is: 2 + 3 = 5
OSPF Areas:
OSPF Process:
1. Become neighbours – Two routers running OSPF on the same link agree to form a
neighbour relationship.
2. Exchange DB information and LSAs – The neighbour routers swap their LSDB and LSAs
information with each other.
3. Choose the best routes – Each router chooses the best routes to add to its routing table
based on the learned LSDB information. (Using Dijkstra algorithm)
OSPF discovers neighbors by sending Hello packets through the router interfaces.
OSPF uses Link State Advertisement (LSA) to exchange information about the network
topology between routers. When a router receives an LSA, it is stored in the Link-State
DataBase (LSDB). Once the LSDBs between routers are in sync, OSPF uses the Shortest
Path First (SPF) algorithm to calculate the best routes for each network. It is important to
understand that LSAs are information about a route that is transported inside Link State
Update (LSU) packets.
Each single Link State Update (LSU) packet can contain one or more LSAs inside it
and when an LSU is sent between OSPF routers, it floods the LSA information through the
network.
All routers within the same Area have the same topology table i.e. same Link State
Database- but different routing table as OSPF calculates different best paths for each router
depending on its location within the network topology.
Step 1: Become neighbours
HOW OSPF FORMS NEIGHBOR RELATIONS?
OSPF discovers neighbors by sending Hello packets through the router interfaces and
meeting certain criteria.
HELLO PACKET
An OSPF router generates a Hello packet at an interval of every 10 seconds for Peer-
to-Peer (P2P) networks by default. And advertises it through multicast address 224.0.0.5 to
all routers connected to its interfaces while it searches for potential OSPF neighbors. The
Hello message contains a list of information needed to form an OSPF neighbor relation
between two neighboring routers. Some of the information contained in the Hello messages
are:
Router ID. The router’s ID which is manually configured or automatically selected by
OSPF.
Hello Interval. Time Interval upon which Hello packets are sent.
Dead Interval. Defines how long we should wait for hello packets before we declare the
neighbor as dead.
Router Priority. Used to help determine the Designated Router (DR).
Area ID
Authentication Password (if configured)
Subnet Mask
The following conditions must be met for two routers to become neighbors:
1. They must have the same IP network/subnet
2. The Hello and Dead Interval timers must be identical.
3. Router interfaces connecting two routers must have the same Area ID
4. Authentication password (if used) must be identical
2. Link State DataBase (LSDB): LSDB packet contains all updated link-state information
exchanged among the network, and all routers within the same area have identical LSDB, and
when two routers form new neighbor adjacency, they sync their LSDB to be fully adjacent.
3. Link State Request (LSR): Once neighbor adjacency is formed and LSDB is exchanged,
neighbor routers may locate missing LSDB information, they then send a request packet to
claim the missing piece. Neighbors receive this packet and respond with LSU.
4. Link State Update (LSU): A response packet sends a specific piece of LSDB information
requested by an OSPF neighbor via LSR packet.
5. Link State Acknowledgment (LSAcK): The router that sends the LSR packet confirms
receiving the LSU from neighbor by sending a confirmation packet acknowledging receiving
the requested LSUs.
Students are encouraged to read more about OSPF Network Types, DR/BDR-role and
election process, States of router during neighbour adjacencies, Cost calculation, Virtual
Link.
Homework
Q. Compare Link State routing protocol with Distance Vector routing protocol.
IS-IS (Intermediate System -to- Intermediate System)
IS-IS (Intermediate System -to- Intermediate System) is a standardized link-state protocol.
IS-IS shares many similarities to OSPF. IS-IS is predominantly used by ISPs, due to its
scalability.
Path Vector
Path vector routing is exterior routing protocol proved to be useful for inter-domain or
inter-AS routing. Path vector routing protocol extends distance vector routing protocol. In
distance vector routing, a router has a list of networks that can be reachable in the same AS
with the corresponding cost (number of hops). In path vector routing, a router has a list of
networks that can be reached with the path (list of AS to pass) to reach each one.
In other words, the domain of operation of the distance vector routing is a single AS
whereas the domain of operation of the path vector is the whole internet. The distance vector
routing tells us the distance to each network and the path vector routing tells the path.
For each TCP connection, the two routers at the end of connection are called BGP
peers, and the TCP connection along with all the BGP messages sent over the
connection is called a BGP session.
For BGP to function, BGP routers must form a neighbor relationship (called peer).
There are two types of BGP relationships:
o iBGP Peers - BGP neighbors within the same AS.
o eBGP Peers - BGP neighbors connection different AS.
A BGP session that spans two AS is called an external BGP (eBGP) session¸ and a
BGP session between routers in the same AS is called an internal BGP (iBGP)
session. In above figure Router B and Router C both in AS200 will form iBGP peer
relationship and RouterA in AS100 & RouterB in AS2200 will form eBGP Peers
relationship.
The Administrative Distance (AD) for routes learned outside the Autonomous
System (eBGP routes) is 20, while the AD for iBGP route is 200.
Two of the more important attributes are AS-PATH and NEXT-HOP.
o AS-Path – This defines the list of AS through the destination can be reached.
o Next-Hop – This defines the next router to which the data packet should be
sent.
BGP supports CIDR.
BGP also supports Security.
When a gateway router receives a router receives a route advertisement, it uses its
Import Policy to decide whether to accept or decline the route though its AS. Such
routing policy is referred as Policy Based Routing.
Q. A, B, C, D, E, F, G & H are interconnected routers as shown in the figure below. Each link
represents a physical link directly between each two routers. Assume that a link state protocol
is used in all routers, and that the number on each link represents the cost of each link. Find
the shortest path from node F to all other nodes and based on the result, write down F’s
forwarding table (on the format destination/next_hop) for all destinations. [4-2016]
H 2
14
4 B
G 9 1
1 A
6 D 2
3 1
F 1 4
1 C
E 3
Q. Define Routing [1]
Q. If you are assigned an IP address 92.16.1.0/24 and plans to deploy CIDR. Here are some
requirements which you have to fulfil: for Subnet A= 120 hosts, Subnet B= 60 hosts, Subnet C=30
hosts, Subnet D= 10 hosts and Subnet E= 5 hosts. You are required to calculate subnet mask, range,
network id and broadcast id for each subnet. [4]
Q. Write down the first IP and last IP of given IP address 192.168.100.197/27. Also write the subnet
mask of given IP. [1-2018]
Q. The Asia Pacific Network Information Center (APNIC) has to provide service to 8 Local ISPs
from the network pool of 215.10.0.0/20. From the available pool each Local ISP has to provide
service to their 4 dedicated clients. Design the complete IP Address Plan which includes IP Pool,
Usable IP Pool and Subnet Mask for each network. [4-2018]
Q. What is count to infinity problem? Explain any two solutions to the problem.[5-2018]
Q. What is the aggregated network of the following subnets: 10.0.0.0/10, 10.64.0.0/10, 10.128.0.0/10
and 10.192.0.0/10? [1-2019]
7
B C
2 3
2 3
A E 2 F D
1 2
6 2
G 4 H