Net 4
Net 4
1. Introduction to Routing
IP Routing moves packets from router to router based on the destination IP address.
Routing Protocols select the best paths based on cost, speed, and congestion.
2. Routing Algorithms
Dynamic Routing: Uses protocols like RIP and OSPF to update routes automatically.
1
Inter-AS Routing: Routing between ASes (e.g., BGP).
What is IP Routing?
IP routing is the process of moving data packets from one device to another across a network
until they reach their final destination. Each packet has a destination IP address in its header,
which routers use to decide where to send it next.
2. The postal system (routers) checks the address and forwards the letter to the next stop.
Similarly, in networking, routers guide packets across the internet using routing tables and
algorithms.
Routing and forwarding are two key functions that work together to move packets through a
network:
2
o Updates and maintains a routing table with information on available paths.
o Uses the routing table to decide which outgoing link to send the packet through.
o Uses a local forwarding table to quickly match a destination with an output link.
🔹 Example:
Imagine a package delivery system:
Forwarding is like handing the package to the next truck in the chain.
Every router in a network routes packets by choosing a path and forwards them to the next
router until they arrive at their destination.
The routing algorithm decides the best overall path a packet should take from the
source to the destination.
It considers factors like distance, congestion, and cost to find an efficient route.
o Link-State (Dijkstra’s Algorithm) → Builds a network map and finds the shortest
path.
The forwarding table is used by each router to decide where to send a packet next.
It doesn’t care about the entire route—just the next hop in the path.
3
o Next-hop router (where to send the packet).
🔹 Example:
Think of a highway toll booth:
The booth agent (router) only decides which road (output link) to direct cars onto.
They don’t decide the entire journey—just the next turn based on the driver’s
destination.
2. The forwarding table at each router ensures the packet moves step by step.
🚀 Analogy:
Forwarding Table → At each junction, the GPS directs you to the next road.
A routing protocol is a set of rules that routers follow to communicate with each other and
determine the best way to forward packets.
The primary goal of a routing protocol is to determine a “good” path for data to travel through
the network. A good path is one that is:
1. Least Cost → Uses the shortest or cheapest route based on predefined metrics (hop
count, bandwidth, etc.).
4
6. Efficient in Resource Use → Minimizes CPU, memory, and bandwidth usage.
7. Scalable → Works well in both small and large networks without excessive overhead.
🔹 Path Selection → The protocol determines which sequence of routers packets should pass
through to reach the destination.
🔹 Convergence Speed → When a router or link fails, the protocol must quickly update and
reroute traffic to prevent delays.
🔹 Routing Overhead → Every protocol consumes CPU, memory, and bandwidth. Efficient
protocols minimize overhead while still maintaining accurate routing.
🔹 Scalability → Some protocols work well in small networks, but struggle in large-scale
networks like the internet.
5
A routing table is a key component of a router that helps it decide where to send data packets.
It acts like a map, telling the router the best way to forward packets to their destination.
Every routing table must have at least two essential pieces of information:
1️⃣ Destination Network → The final network where the packet is headed.
2️⃣ Next Hop → The next router or device the packet should be forwarded to on its way to the
destination.
📌 Hop-by-Hop Routing:
Routers don’t know the full path to the destination. They only know the next stop (next
hop).
Each router along the way makes its own decision about where to send the packet next.
🔹 Analogy:
Think of a bus journey from City A to City D:
You don’t have a direct bus from A to D, but you first take a bus to City B (next hop).
At each stop, you only need to know where to go next, not the entire route.
Example: A router connected to 192.168.1.0/24 will have an entry for that network in its
routing table.
6
Example: ip route 192.168.2.0 255.255.255.0 10.1.1.1 → This means, "To reach
192.168.2.0, send packets to 10.1.1.1 (next hop)."
❌ Disadvantage: If the next hop fails, the route does not change automatically.
Protocols like RIP, OSPF, and BGP allow routers to share routing information and update
their tables automatically.
When a network link fails, these protocols find an alternative path without manual
intervention.
Directly
192.168.1.0/24 eth0 0
Connected
Explanation:
Summary
✅ The routing table contains destination networks and their next hops.
✅ Routing follows a hop-by-hop approach—routers only know the next step, not the entire
journey.
✅ Routes can be learned through:
✔ Directly connected networks (automatic)
✔ Static routes (manual, fixed)
✔ Dynamic routing protocols (automatic, adaptable)
7
Directly Connected Networks
A directly connected network is a network that is physically attached to one of the router’s
interfaces. Since the router has a direct connection to this network, it automatically knows how
to reach it—without needing any routing protocol or manual configuration.
✔ No special routing mechanism needed → The router does not need RIP, OSPF, or static
routes to recognize the network.
✔ Immediately accessible → As soon as the network is connected to the router, it appears in
the routing table.
✔ Automatically installed in the routing table → If the interface is UP, the router adds the
network to its routing table.
✔ If the interface goes DOWN, the route is removed automatically.
If both interfaces are active, the routing table looks like this:
Directly
192.168.1.0/24 eth0
Connected
Directly
10.0.0.0/8 eth1
Connected
If eth0 is disconnected, the router automatically removes the entry for 192.168.1.0/24
from its routing table.
8
Real-World Analogy
If a road leads directly into the community, the guard immediately knows where it goes
(directly connected network).
If the road is blocked (interface goes down), no one can use that route anymore, and it’s
removed from the map (routing table).
If a router learns the same destination route from multiple sources (e.g., OSPF and Static
Route), it decides which route to install in the routing table based on Administrative Distance
(AD).
AD is a measure of trustworthiness—the lower the AD, the more preferred the route.
👉 The static route will be chosen and installed in the routing table because it has a lower AD.
👉 OSPF's route will be ignored unless the static route is removed.
Key Takeaways
9
Three Key Processes in IP Routing
Every router performs three main sets of tasks to ensure proper IP routing:
Uses Administrative Distance (AD) to decide which route is more trustworthy if the
same route is learned from multiple sources.
When a packet arrives, the router checks the destination IP address in its routing table.
Uses Longest Prefix Match (LPM) to find the most specific route.
Example Scenario
10
Routing algorithms help determine the best path for packets. They can be classified based on
how they gather and use information:
Each router knows the entire network topology and the cost of every link.
Routers flood the network with information to build a complete network map.
Example Protocols: OSPF (Open Shortest Path First), IS-IS (Intermediate System to
Intermediate System)
Each router only knows its neighbors and link costs to them.
Uses an iterative process where routers exchange distance (cost) information with
neighbors.
Summary
The diagram on page 15 represents a graph abstraction of a network. Here's what it means in
simple terms:
11
A network can be modeled as a graph:
Routers (Nodes) = { u, v, w, x, y, z }
Links (Edges) = { (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
The graph model helps routers compute the best path between any two nodes.
Example Application
If a packet needs to go from u → z, the routing algorithm will check the shortest or best path
based on link costs and update the routing table accordingly.
The graph abstraction assigns a cost to each link between routers. The goal of a routing
algorithm is to find the least-cost path between two nodes (routers).
c(x, x') represents the cost of the link between router x and x'.
12
Bellman-Ford Algorithm (for Distance Vector routing)
Key Idea: Each router shares information about its directly connected neighbors with every
other router in the network. This allows all routers to build a complete map of the network and
compute the shortest paths independently.
How It Works:
1. Discover Neighbors
o Each router finds out which other routers are directly connected to it.
o Each router sends updates about its neighbors to every other router in the
network.
o Using the collected information, each router constructs a graph representing the
network.
o Each router runs Dijkstra’s algorithm on its own map to determine the shortest
paths to all other routers.
o The result is a forwarding table, which tells the router where to send packets for
each destination.
✔ Fast Convergence: Since every router has a full network map, it quickly recalculates paths
when a link fails.
✔ Loop-Free Paths: Because routers compute the shortest path independently, routing loops
13
are avoided.
✔ Scalability: Works well in large networks compared to Distance Vector algorithms.
1️⃣ Initialize:
For all other nodes vvv, set D(v)=∞D(v) = \inftyD(v)=∞ (unknown cost).
Pick the unvisited node www with the smallest D(w)D(w)D(w) (least cost path known so
far).
Add www to N', the set of nodes whose shortest path is now known.
Continue selecting the node with the lowest current cost, updating its neighbors, until
all nodes have their shortest path determined.
Let's apply Dijkstra’s Algorithm step by step using the graph you provided earlier:
Graph: G = (N, E)
Edges (Links):
E={(u,v),(u,x),(v,x),(v,w),(x,w),(x,y),(w,y),(w,z),(y,z)}E = \{ (u,v), (u,x), (v,x), (v,w), (x,w),
(x,y), (w,y), (w,z), (y,z) \}E={(u,v),(u,x),(v,x),(v,w),(x,w),(x,y),(w,y),(w,z),(y,z)}
14
Step 1: Initialization
Step 2: Add u to N’
N′={u}N' = \{ u \}N′={u}
Update neighbors of u:
o D(v)=c(u,v)D(v) = c(u,v)D(v)=c(u,v)
o D(x)=c(u,x)D(x) = c(u,x)D(x)=c(u,x)
2. Add it to N′N'N′
Think of the Distance Vector (DV) algorithm like spreading gossip in a school.
o Every router (like a student) shares what it knows about reaching different places
(routes) with its neighboring routers (friends).
o Each router tells its own neighbors what it knows, and they tell their neighbors,
and so on—just like how rumors spread in school.
15
3. Add new information to your knowledge
o If a router hears about a new route (a place it didn’t know before), it adds it to
its list (routing table).
o If a router already knows about a route but hears about a shorter (better) way, it
updates its table with the shorter route—just like choosing a shorter path to class
instead of a longer one.
o Just like rumors, incorrect routing information (like a broken route) can spread
quickly, making routers send data the wrong way until they correct the mistake.
This method is simple but can sometimes lead to problems if bad information spreads before
it’s corrected. 🚦
The Bellman-Ford equation is the foundation of the Distance Vector (DV) algorithm, which
helps routers find the shortest path in a network.
The image explains an example of the Bellman-Ford algorithm, showing how router u
determines the shortest path to z.
We need to compute du(z)d_u(z)du(z), the shortest distance from u to z using the Bellman-Ford
equation:
16
du(z)=min(7,4,8)=4d_u(z) = \min(7, 4, 8) = 4du(z)=min(7,4,8)=4
Final Takeaway:
In a real network, router u would update its routing table to forward packets to z via x.
This is how Bellman-Ford helps routers dynamically find the shortest paths. 🚀
Understanding the Distance Vector Algorithm (DV) and Bellman-Ford (B-F) Equation
The key idea of the Distance Vector (DV) algorithm is that each router (node) keeps a table
(called a distance vector) with estimates of the shortest paths to all other nodes in the network.
These estimates are updated by exchanging information with neighboring routers.
1. Each router maintains a table with the estimated cost (distance) to reach every other
router.
2. Periodically, it shares its distance vector with only its direct neighbors.
3. When a router (x) receives an updated distance vector from a neighbor (v), it
recalculates its own estimate using the Bellman-Ford equation:
o Dv(y)D_v(y)Dv(y) = Distance estimate from vvv to yyy (which xxx got from vvv)
o The minimum value is selected because we always want the shortest path.
Under normal conditions (no sudden failures, stable network), these updates eventually
converge to the actual shortest distances.
Over multiple iterations, each router refines its estimates until every router has the
correct shortest paths.
Example
17
Suppose router A has direct links to B and C:
Cost to B = 2
Cost to C = 5
This process repeats across the network until all routers have the best possible paths.
The Distance Vector (DV) algorithm is a fundamental approach for routing in computer
networks. It works by having each node update its routing table based on information received
from its neighbors.
The algorithm does not run at fixed time intervals; instead, it updates dynamically based on:
2. Distributed Operation
Each node in the network operates independently but cooperates with its neighbors. The
process follows these rules:
18
A node only notifies its neighbors when its own DV changes.
Neighbors then update their own DVs if necessary and may propagate the changes
further.
This process continues until no more updates are needed, leading to convergence.
Key Properties
🚨 Drawback: Can suffer from the count-to-infinity problem, where updates take a long time to
propagate in certain failure scenarios. This is mitigated using techniques like split horizon and
poison reverse.
Each router in a network running the Distance Vector (DV) Algorithm follows a set of update
rules to maintain its Routing Information Base (RIB). These operations ensure efficient and
correct routing.
19
Each node sends its distance vector (list of estimated shortest path costs) to its directly
connected neighbors.
This helps nodes learn about changes in the network and update their own routing
tables accordingly.
When Router K receives a distance vector update from its neighbor Router J, it processes the
update using these three rules:
📌 If J lists a destination that K does not have in its RIB, K adds an entry:
Next hop: J
✔ Example:
If J advertises a route to D with a distance of 5, and the cost of the link (K → J) is 2, then K adds
D to its table with distance 7.
Next hop: J
✔ Example:
20
📌 If K’s route to D already lists J as the next hop, and J’s distance to D changes, then K:
✔ Example:
Conclusion
✔ This iterative process continues until all routers have the correct shortest path information.
✔ Only necessary updates are sent, reducing overhead.
✔ Helps maintain efficient and adaptive routing in dynamic networks.
The Distance Vector (DV) Algorithm helps routers find the shortest path to other routers in a
network. Each node (router) shares its distance to other nodes with its neighbors. Over time,
the nodes update their tables to reflect the shortest known paths.
The image shows three routers (nodes) X, Y, and Z exchanging distance information to compute
the shortest paths. Let’s break it down step by step.
Each node starts with a routing table listing the costs (distances) to itself and its direct
neighbors.
21
From X To X Y Z
X 0 2 7
Y ∞ ∞∞
Z ∞ ∞∞
From Y To X Y Z
X ∞ ∞∞
Y 0 1 0
Z ∞ ∞∞
From Z To X Y Z
X ∞ ∞∞
Y ∞ ∞∞
Z 7 1 0
This means that for each destination yyy, node xxx looks at all possible paths through
its neighbors and picks the shortest one.
For example:
22
It knows:
Since 3 is less than 7, X updates its table to reflect this shorter path!
From X To X Y Z
X 0 23
Neighbors then update their own tables and may pass the new information forward.
Key Takeaways
The image illustrates how routers exchange distance information using the Distance Vector
Routing Algorithm to determine the shortest paths in a network.
23
o These represent routers in a network.
o Each node maintains a routing table that stores the cost to reach other nodes.
o For example:
o Each node updates its table by finding the minimum cost to reach other nodes.
o This means Node X finds a shorter path to Z through Y, reducing the cost from 7
to 3.
Conclusion
Each router updates its table based on the shortest path found.
This process continues until all routers agree on the best paths.
This is the fundamental principle of Distance Vector Routing, used in protocols like RIP (Routing
Information Protocol) for network communication.
24
The slow convergence problem in distance-vector routing happens when routers take a long
time to detect failures and update their routing tables correctly. This issue is also known as the
count-to-infinity problem. Let's break it down step by step based on your scenario:
o R1 → Network 1 (direct)
R1, unaware of the actual failure, thinks it can reach Network 1 through R2 with a cost
of 3.
25
This cycle continues, increasing the hop count indefinitely (e.g., 3 → 4 → 5 …).
The hop count keeps increasing in small steps instead of quickly marking the route as
unreachable.
1. Split Horizon
o Routers do not advertise routes back to the neighbor they learned them from.
2. Poison Reverse
o Instead of not advertising, routers explicitly send an infinite metric (∞) back to
the neighbor.
3. Triggered Updates
Conclusion
The slow convergence problem causes routers to take too long to react to failures due to
repeated incorrect updates. Protocols like RIP (Routing Information Protocol) suffer from this
issue, while modern routing protocols like OSPF (Open Shortest Path First) use a different
approach (link-state routing) to avoid it.
26
Interconnected Autonomous Systems (AS) in Networking
An Autonomous System (AS) is a group of IP networks and routers under the control of a single
organization that follows a common routing policy. Each AS is assigned a unique Autonomous
System Number (ASN) by the Internet Assigned Numbers Authority (IANA) or regional
registries like ARIN, RIPE, and APNIC.
Examples of AS owners:
Autonomous Systems communicate with each other to exchange routing information and
ensure global internet connectivity. The connection between ASes follows two major routing
policies:
Examples: OSPF (Open Shortest Path First), IS-IS (Intermediate System to Intermediate
System), RIP (Routing Information Protocol), EIGRP (Enhanced Interior Gateway
Routing Protocol).
BGP enables inter-AS routing by sharing network reachability information with other
ASes.
27
Autonomous Systems connect in different ways based on their relationships:
Example: A small ISP (AS 200) buys connectivity from a larger ISP (AS 100).
Example: Google (AS 15169) and Microsoft (AS 8075) exchange traffic directly instead
of using a transit ISP.
Example: A university (AS 300) connects to both AT&T (AS 7018) and Verizon (AS 701)
to ensure continuous internet access.
BGP (Border Gateway Protocol) is the standard for exchanging routing information
between ASes.
BGP prevents routing loops and optimizes paths for global internet routing.
o Path selection based on metrics like AS path length and policy preferences.
28
2. The ISP (AS 200) connects to a Tier 1 ISP (AS 100).
3. The Tier 1 ISP connects to another Tier 1 ISP (AS 500) via peering.
4. A request from the user to a website hosted on Google Cloud (AS 15169) is routed
through multiple ASes before reaching Google’s servers.
1. Memory Limitations:
o With over 600 million destinations (IPv4/IPv6 addresses), storing all routes in
every router is impossible.
3. Administrative Control:
Hierarchical routing divides the network into multiple levels to reduce complexity.
29
A. Autonomous Systems (AS)
Uses Interior Gateway Protocols (IGPs) like OSPF, RIP, EIGRP for internal routing.
Uses Exterior Gateway Protocols (EGPs) like BGP to communicate with other ASes.
B. Subnet Hierarchy
Reduces routing table size by aggregating multiple IP addresses into one entry (e.g.,
CIDR).
✅ Smaller Routing Tables → Routers store only summarized routes instead of full details.
✅ Less Routing Overhead → Reduces the amount of exchanged routing information.
✅ Faster Convergence → Routing updates affect fewer routers, reducing downtime.
✅ Administrative Control → Each AS can define its internal routing policies.
30
📌 Example: A user at KNUST (AS 3000) wants to access a website hosted on Amazon AWS (AS
16509).
Step 3: The regional ISP routes the request to a Tier-1 ISP (AS 100).
Step 4: The Tier-1 ISP finds the shortest BGP path to Amazon’s AS (AS 16509).
5. Key Takeaways
To make routing scalable, the internet is organized into Autonomous Systems (AS)—
independent networks controlled by different organizations.
2. Types of Routing in an AS
31
Used within an AS.
Common IGPs:
BGP helps ASes exchange routes and decide the best path for traffic.
📌 Suppose a user at KNUST (AS 3000) wants to access a website on Google (AS 15169).
1️⃣ KNUST’s internal routers use OSPF (intra-AS routing) to find the best path to its gateway
router.
32
2️⃣ The gateway router uses BGP to communicate with an ISP’s AS (AS 200).
3️⃣ ISP (AS 200) uses BGP to find a route to Google’s AS (AS 15169).
4️⃣ Google’s gateway router forwards traffic to the appropriate internal router using OSPF.
5️⃣ Response follows the same path in reverse.
6. Key Takeaways
Your uploaded image illustrates hierarchical routing with interconnected Autonomous Systems
(ASs). Here's a breakdown of the key concepts shown:
OSPF (Open Shortest Path First) – A link-state protocol used in large networks.
🔹 Used to exchange routes between different ASs (e.g., AS 100 and AS 200).
🔹 ASes can run different intra-AS protocols, but must use a common inter-AS protocol.
🔹 The most widely used EGP is BGP (Border Gateway Protocol).
Your uploaded image illustrates hierarchical routing with interconnected Autonomous Systems
(ASs). Here's a breakdown of the key concepts shown:
OSPF (Open Shortest Path First) – A link-state protocol used in large networks.
🔹 Used to exchange routes between different ASs (e.g., AS 100 and AS 200).
🔹 ASes can run different intra-AS protocols, but must use a common inter-AS protocol.
🔹 The most widely used EGP is BGP (Border Gateway Protocol).
✅ AS 100 and AS 200 are separate networks, each using its own intra-AS routing (RIP, IGRP).
✅ Gateway routers connect these ASes and use an exterior routing protocol (like BGP).
✅ Scalability – Instead of every router storing all global routes, ASes aggregate routing
information.
Great points! The key reason for separating intra-AS and inter-AS routing is that they serve
different purposes and have different constraints. Let's break it down further:
34
1. Policy Differences
Routing decisions are based on business relationships (e.g., peering agreements, cost).
No need for complex policies—just find the best route within the AS.
Routes are selected purely based on performance (e.g., shortest path, least delay).
2. Scalability
🔹 The Internet has millions of destinations—storing all routes in every router is impractical.
🔹 Hierarchical routing reduces:
Update traffic (by keeping most routing updates local to the AS).
🔹 Intra-AS Routing
Uses protocols like OSPF that select paths based on network performance.
🔹 Inter-AS Routing
Business and security policies often take priority over shortest path.
BGP may choose a longer path due to economic agreements rather than speed.
Key Takeaway
35
✅ IGP (Intra-AS routing) = Optimize network performance (shortest path, lowest delay).
✅ EGP (Inter-AS routing) = Control and policy-driven routing (who routes through whom).
✅ Hierarchical routing keeps things scalable and manageable.
1. Historical Background
🔹 Routing Metric:
Maximum hop count = 15 (if 16, it's considered infinity → route is unreachable)
🔹 Periodic Updates:
🔹 Route Selection:
3. Limitations of RIP
⚠️Slow Convergence: Takes time to recover from link failures (count-to-infinity problem)
⚠️Scalability Issues: Max 15 hops limits use in large networks
⚠️No Load Balancing: Treats all paths equally, doesn’t consider bandwidth or delay
✅ Despite limitations, RIP is simple and easy to configure, making it useful for small networks
or as a backup protocol.
36
Page 42
Router D maintains a routing table using the Routing Information Protocol (RIP), which is a
distance vector routing protocol. In this method, each router periodically shares its routing
table with its neighbors, allowing updates to propagate through the network. Here’s how it
works for router D in the given example:
RIP uses hop count as its metric. A hop is one router-to-router transition.
Every 30 seconds, routers exchange updates with their directly connected neighbors.
37
Next Router: The next-hop router that should be used to reach that subnet.
Hops to Destination: The number of routers (hops) needed to reach the destination.
w A 2
y B 2
z B 7
x (unknown) (unknown)
To reach "z" → Router D will also use router B, but this takes 7 hops.
To reach "x" → No clear route is listed, meaning x is either unreachable or missing from
this table.
Each router sends updates to its neighbors listing known destinations and hop counts.
o A route becomes unreachable (i.e., if no update is received for 180 seconds, the
route is removed).
38
Pg 43
We now compare each destination in the update message with the existing RIB.
39
Existing Distance (RIB Incoming Distance (from J) + 1
Destination Update Needed?
in K) (hop to J)
✅ Update (shorter
Net 4 8 via L 3+1 = 4
route)
Net 1 0 direct
Net 2 0 direct
Net 4 4 Router J
Net 17 5 Router M
Net 21 5 Router J
Net 24 6 Router J
40
Destination Distance Route
Net 30 2 Router Q
Net 42 2 Router J
Final Answers
(a) How many items in the update message cause a change in Router K’s RIB?
✅ 2 items (Net 4 and Net 21).
Routing Information Protocol (RIP) handles link failures and recovery using a timeout and
update mechanism. Here’s how it works:
If a router does not receive an advertisement from a neighbor for 180 seconds, the link
is considered down.
The router sends new advertisements to its neighbors, informing them that the affected
routes are no longer valid.
Neighbors update their routing tables accordingly and forward the updated
information.
Poison Reverse is used to prevent "ping-pong" loops, where routers keep advertising
the same broken route back and forth.
41
Instead of just removing the route, RIP sets the distance to 16 hops (infinite), ensuring it
is considered unreachable.
4. Link Recovery
If a failed link comes back up, the router will eventually receive advertisements from its
neighbor.
It will then update its routing table with the restored path.
Key Takeaways
RIP (Routing Information Protocol) manages routing tables using a daemon process and UDP-
based advertisements. Here's how it works:
RIP routing tables are handled by an application-level process called routed (daemon).
This daemon updates and maintains the routing table based on received RIP
advertisements.
It ensures that the router always has the best available paths to destinations.
2. Advertisement Process
These updates are transmitted using UDP (User Datagram Protocol), specifically on port
520.
The updates are sent every 30 seconds to inform neighboring routers of the current
routes.
3. Routing Updates
42
Each update message includes:
When a router receives an update, it compares the new information with its existing
table:
o If the update provides a shorter route, the router updates its table.
o If the advertised distance is worse (longer route), the router ignores it (or waits
for failure detection).
Key Takeaways
✔ Daemon Process: RIP routing tables are handled by the routed daemon.
✔ UDP-Based Communication: Updates are sent via UDP port 520 every 30 seconds.
✔ Routing Table Updates: Routers adjust their tables based on new advertisements.
OSPF is a link-state routing protocol designed for large and complex networks. Unlike RIP,
which relies on hop counts, OSPF provides faster convergence and more efficient routing using
Dijkstra's algorithm.
1. Why "Open"?
OSPF is an open standard, meaning it's publicly available and not proprietary like Cisco’s
EIGRP.
Defined in RFC 1247, RFC 2328, and OSPFv3 for IPv6 (RFC 5340).
Each router constructs a complete topological map of the network (not just next-hop
distances like RIP).
43
Uses Dijkstra’s Shortest Path First (SPF) Algorithm to compute the best route.
Routers flood link-state advertisements (LSAs) to ensure all routers have the same
network view.
Updates are triggered by changes in topology rather than periodic updates (unlike RIP's
30s interval).
c) Area-Based Hierarchy
OSPF determines the best path using a cost metric based on bandwidth (instead of RIP’s
simple hop count).
Higher bandwidth links have lower cost, making them preferable for routing.
1. Neighbor Discovery:
2. Topology Exchange:
o Each router sends LSAs to all other routers in the OSPF area.
3. SPF Calculation:
o Using Dijkstra’s Algorithm, each router computes the shortest path tree (SPT)
for routing.
o The best paths are stored in the routing table, and the router starts forwarding
packets accordingly.
44
4. OSPF vs. RIP
Unlike RIP, which uses UDP, OSPF sends messages directly over IP (Protocol 89).
Advertisements are flooded across the entire Autonomous System (AS) for consistency.
Conclusion
OSPF is a powerful, scalable, and efficient routing protocol ideal for large networks. It uses link-
state advertisements (LSAs), Dijkstra’s algorithm, and a cost-based metric for optimal path
selection. It is far superior to RIP in terms of convergence speed, efficiency, and scalability.
OSPF performs multiple tasks to ensure efficient routing and fast convergence. These tasks are
divided into three main categories: Neighbor Management, Database Management, and
Routing Table Operations.
1. Neighbor Management
45
OSPF routers must discover and maintain relationships with other routers to exchange routing
information.
a) Discovery
If two routers agree on OSPF parameters (Area ID, Hello interval, etc.), they form an
adjacency.
Designated Router (DR) and Backup Designated Router (BDR) are elected on multi-
access networks (e.g., Ethernet) to reduce overhead.
b) Maintenance
If a neighbor fails to respond within a timeout period, OSPF removes the route and
recalculates the shortest paths.
2. Database Management
OSPF routers store and synchronize a Link-State Database (LSDB), which contains a complete
map of the network.
a) Granularity
Each router knows the entire network structure, not just next-hop distances like RIP.
b) Maintenance (Updates)
When topology changes, routers generate Link-State Advertisements (LSAs) and flood
them to update all routers.
Unlike RIP, OSPF only sends updates when needed, reducing unnecessary traffic.
c) Synchronization
When a new router joins, it synchronizes its LSDB with other routers.
Database Description (DBD) packets and Link-State Requests (LSR) are used for
synchronization.
46
3. Routing Table Operations
The Routing Information Base (RIB) is built from the LSDB and determines how packets are
forwarded.
a) Metric
b) Calculation
OSPF runs Dijkstra’s Shortest Path First (SPF) algorithm to compute the best routes.
It constructs a Shortest Path Tree (SPT) from the LSDB and selects the lowest-cost
paths.
c) Update
When network changes occur (e.g., link failure, new router), OSPF recalculates the
shortest path and updates the routing table.
Summary Table
Task Description
Database Maintenance Updates LSDB using LSAs only when changes occur
47
Task Description
Database Synchronization Ensures all routers have the same network view
Routing Table Update Adjusts routing table dynamically when topology changes
Conclusion
OSPFv2 (used for IPv4 networks) consists of several key components that work together to
enable efficient routing. Here’s a breakdown of these components in simple terms:
OSPF routers discover and maintain connections with other routers using Hello packets.
These packets are sent periodically to detect new neighbors and check if existing
neighbors are still active.
If a neighbor fails to respond, OSPF removes it from the routing table and recalculates
paths.
📌 Example:
If Router A stops receiving Hello messages from Router B, it assumes Router B is down
and updates the network topology.
48
Once routers discover each other, they need to synchronize their Link-State Databases
(LSDBs).
The synchronization process uses Database Description (DBD) packets and Link-State
Requests (LSR).
📌 Example:
The existing router sends the missing updates, ensuring the new router has the
complete topology map.
📌 Example:
4. Designated Router (DR) / Backup Designated Router (BDR) Election: “With whom do I want
to talk?”
In multi-access networks (like Ethernet), flooding updates to every router can cause
high traffic.
To reduce this, OSPF elects a Designated Router (DR) and a Backup Designated Router
(BDR).
The DR handles most communication, and the BDR takes over if the DR fails.
49
📌 Example:
🔹 Election Process:
If there’s a tie, the router with the highest Router ID (RID) is chosen.
5. Route Computation
Each router has the same LSDB, ensuring consistent routing decisions.
b) Dijkstra’s Algorithm
OSPF uses Dijkstra’s Shortest Path First (SPF) algorithm to compute the best paths.
If multiple paths have the same cost, OSPF splits traffic across them.
📌 Example:
If Router A has two paths to Router Z, both with a cost of 10, OSPF can use both paths
simultaneously.
Summary Table
Component Function
50
Component Function
Equal-Cost Path Routing Supports load balancing with multiple equal-cost paths
Conclusion
OSPFv2 ensures fast, efficient, and scalable routing by using Hello messages for neighbor
detection, flooding for updates, DR/BDR for efficiency, and Dijkstra’s algorithm for optimal
path selection
This image represents the OSPFv2 Packet Header Format, which is 24 octets long and is
included in every OSPF message. Below is a breakdown of each field in the header:
51
Field Size Description
data).
The Type field in the header specifies the kind of OSPF message. Common types include:
The image provides a list of the five OSPF packet types along with their meanings. Here’s a
detailed explanation:
52
OSPF Packet Types and Their Functions
1. Hello Packet
o Contains parameters like router ID, hello/dead intervals, area ID, and
authentication.
OSPF Characteristics
53
The Hello Protocol is a crucial part of OSPF, responsible for neighbor discovery, maintenance,
and failure detection.
1. Bidirectional Communication
o Ensures that routers can send and receive packets from each other.
2. Parameter Agreement
54
o Second-highest becomes the BDR.
The Database Description (DBD) message is used in OSPF to synchronize link-state databases
between routers.
1. Each router maintains a link-state database (LSDB), which contains Link State
Advertisements (LSAs).
3. If a router finds missing or outdated LSAs, it requests updates using Link State Request
(LSR) messages.
o MTU (Maximum Transmission Unit) – Confirms both routers can handle the
same packet size.
55
Database synchronization ensures network consistency, preventing routing loops and
incorrect paths.
Ensures that OSPF neighbors have the same network topology view.
The Database Description (DBD) message in OSPF helps routers synchronize their Link State
Databases (LSDBs) by summarizing known Link State Advertisements (LSAs).
LS Type Field – Identifies the type of LSA (e.g., Router LSA, Network LSA, etc.).
Link State ID Field – Unique identifier for the LSA, varying by type.
Advertising Router Field – The Router ID of the router that originated the LSA.
o Uses a linear sequence space, meaning higher sequence numbers indicate more
recent LSAs.
56
o If the maximum sequence number is reached, the LSA is refreshed with a new
instance.
LS Age Field
o Maximum age is 1 hour; if LS Age > 1 hour, the LSA is invalid and removed.
The Link-State Request (LSR) message is used in OSPF when a router detects that its Link State
Database (LSDB) is out of date and needs updated information from a neighbor.
Field Description
Specifies the type of LSA being requested (e.g., Router LSA, Network
LS Type
LSA, etc.).
57
Field Description
Advertising Router The Router ID of the router that originally advertised the LSA.
The Link-State Update (LSU) message in OSPFv2 is used to propagate updated routing
information across the network. It contains Link-State Advertisements (LSAs), which describe
the state of a router’s links and the overall network topology.
58
Field Description
List of LSAs Contains one or more LSAs that describe link states.
Each Link-State Advertisement (LSA) inside the LSU message follows a structured format:
LS Sequence Number Tracks LSA versions (prevents loops and stale info).
Link-State Information Data describing the link (e.g., neighbor, cost, etc.).
1️⃣ A router detects a network change (e.g., a link failure or new link).
2️⃣ It generates a new LSA and sends it in an LSU message.
3️⃣ The receiving routers update their LSDB with the new LSA.
4️⃣ The routers send a Link-State Acknowledgment (LSAck) to confirm receipt.
5️⃣ If necessary, the LSA is retransmitted to ensure delivery.
59
✔ Ensures that all routers have the latest routing information.
✔ Helps OSPF quickly adapt to network topology changes.
✔ Supports fast convergence and improves network reliability.
In OSPF, the Designated Router (DR) and Backup Designated Router (BDR) help reduce
overhead in broadcast and multi-access networks (e.g., Ethernet). They minimize the number
of OSPF adjacencies and ensure efficient flooding of routing updates.
If there's a tie, the router with the highest Router ID (RID) is selected.
4️⃣ If no Designated Router (DR) exists:
✔ All routers must agree on the DR and BDR based on received Hello packets.
✔ OSPF Priority:
60
🔹 Why Use DR and BDR?
OSPF (Open Shortest Path First) is more advanced than RIP (Routing Information Protocol) due
to its efficiency, scalability, and security. Here are some key advanced features:
1️⃣ Security 🔒
✔ All OSPF messages are authenticated to prevent unauthorized access or malicious attacks.
✔ Authentication types:
✔ Unlike RIP, which selects only one best path, OSPF allows multiple same-cost paths to be
used for load balancing.
✔ These paths are stored in the routing table and can be utilized to share network traffic
efficiently.
✔ Improves network redundancy and throughput.
OSPF (Open Shortest Path First) uses a two-level hierarchical structure for scalability and
efficient routing updates. The key components of this structure include:
62
Exist only within a single area.
Import and export routes between OSPF and non-OSPF protocols (e.g., BGP, EIGRP).
OSPF (Open Shortest Path First) uses areas to improve scalability and efficiency in large
networks. An OSPF Autonomous System (AS) or Routing Domain is divided into multiple areas
to reduce LSA flooding and optimize routing.
63
All other areas must connect to it for inter-area routing.
External LSAs → Advertise routes injected from other ASs (e.g., BGP routes).
✔ Partitioning of Areas
Link or router failures can cause an area to become disconnected from the rest of the
network.
If an area loses its connection to the backbone, it becomes isolated and loses access to
other areas.
If an area loses all paths to Area 0, it is completely cut off and cannot route traffic
beyond its local network.
64
✅ Reduces LSA flooding → Limits updates to within an area, preventing excessive processing.
✅ Speeds up convergence → OSPF routers process fewer LSAs, leading to faster recalculations.
✅ Enhances network stability → If an issue occurs in one area, it doesn’t affect others.
✅ Supports large networks efficiently → Hierarchical design scales better than a single flat OSPF
network.
This slide provides a summary of OSPF (Open Shortest Path First) by categorizing key aspects:
Metric: OSPF uses cost (based on bandwidth) to determine the best path.
Calculation: Uses Dijkstra’s Algorithm (Shortest Path First - SPF) to compute the optimal
route.
This summary breaks down the key elements of OSPF (Open Shortest Path First):
🔹 OSPF Components
65
Granularity: Stores detailed topology information using Link-State Advertisements
(LSAs).
Synchronization: Ensures all routers have consistent LSDB through the synchronization
protocol.
66