Why OSPF?
OSPF is a very important topic for all network engineers. It’s a widely used routing protocol because it is an open standard, meaning it works with any vendor’s devices. This is why it’s so popular in the IT industry.
Nowadays, many types of companies use OSPF in their real-time networks.
Here are some examples:
Large Enterprises: Many large multinational companies use OSPF in their networks. OSPF can handle a large number of routes and quickly find the best path.
ISPs (Internet Service Providers): ISPs use OSPF to manage their internal routing because it’s scalable and has fast convergence.
Data Centers: OSPF is also used in data centers for efficient routing.
Benefits of OSPF
Fast Convergence: OSPF can quickly update its routing tables and find the best path by using the SPF Algorithm and minimizing downtime.
Scalability: OSPF can handle large, complex network topologies. OSPF is an IGP Protocol so it works within the same AS we know but OSPF does not have a concept of AS Number like EIGRP or BGP but still it’s handling the large network because OSPF has the concept of AREA.
Area: OSPF Large network is logically subdivided into areas which help to reduce the size of the routing table and provide efficiency otherwise router routing table will crash in handling a large number of routes at a time.
Route Summarization: Apart from this, OSPF supports route summarization between areas, which helps reduce the size of routing tables and improves efficiency.
Load Balancing: OSPF supports load balancing, It means it distributes network traffic across multiple paths to reduce the load on any single path.
Disadvantage of OSP
We know that every aspect has its advantages, but it also comes with some disadvantages.
Similarly, OSPF has some disadvantages as well:
In OSPF, routers exchange the complete network topology with each other. Each router runs the SPF algorithm on this database to choose the best path for every network and installs the best path in its routing table.
Because routers check all available networks and choose the best path, this process uses a lot of CPU and RAM. So, one disadvantage of OSPF is that it can have high CPU and RAM utilization.
Introduction
- OSPF is an open standard, which means we can run this protocol on any vendor device.
- OSPF operates at Layer 3 of the OSI model.
- OSPF uses the protocol number 89 in the IP header to identify it.
- OSPF uses Two Multicast Address for communication that is 224.0.0.5 & 224.0.0.6
- All OSPF routers use 224.0.0.5 addresses to communicate with each other. This is a multicast address for OSPF messages that need to reach all routers. All routers listen to this address.
- 224.0.0.6, This address is used specifically by OSPF routers to send information to the Designated Router (DR). Only the DR listens to this address.
- OSPF has an administrative distance (AD) of 110. This number represents the trustworthiness of the OSPF routes compared to other routing protocols. Lower numbers are more trusted.
Configurations
Command: Router OSPF < Process – ID > [ Range of Process ID 1 – 65535 ]
Router(config-router)# Network < Network ID / IP Address > < Wild Card Mask > < Area >
e.g – Router(config-router)# network 192.168.1.0 0.0.0.255 area 0 [ Advertising
complete Network ]
Router(config-router)# network 192.168.1.10.0.0.0 area 0 [ Advertising Specific IP Address ]
0.0.0.255 means match the first three octets exactly and ignore the last octet.
0.0.0.0 means match all four octets exactly (a single IP address).
If you do not configure the Network command, the router will not generate any OSPF Messages.
Wildcard Mask
OSPF uses a wildcard mask for its communication, which is the opposite of a subnet mask. While a subnet mask identifies which part of an IP address represents the network and which part represents the host, a wildcard mask identifies which parts of an IP address to include / Consider or ignore when applying OSPF configuration.
Wildcard masks are usually written in the format 0.0.0.255.
For an IP address 192.168.1.10 /24 its subnet mask will be 255.255.255.0 and its wildcard mask will be 0.0.0.255, It specifies that OSPF only cares about the first 24 bits and ignores the last 8 bits.
Check Your Knowledge?
Find Wild card mask of
1) /8
2) /27
AS Number
- OSPF is an Interior Gateway Protocol (IGP) and it is used to find the best paths within a single Autonomous System (AS).
- AS is a large network or group of networks managed by a single organization, like a company.
- OSPF is an IGP, which means it operates within the same AS, but OSPF, routers do not use AS numbers like some other protocols (e.g., BGP, EIGRP).
- Instead, OSPF works by creating areas within the AS to organize the network.
- To manage large networks, OSPF divides the AS into smaller parts called areas. Each area helps organize the network and reduce the size of the Routing Table.
Do You Know?
We know EIGRP is IGP Protocol, Does it use AS Number?
EIGRP is another IGP, used to find the best paths within a single AS, similar to OSPF. However, EIGRP uses AS numbers to distinguish between different instances of EIGRP running on the same router or within the same network.
When you configure EIGRP, you assign an AS number. Only routers with the same EIGRP AS number will share routing information.
If we configure router ospf 100 and router eigrp 100 on the same router, how do these configurations differ, and how do they affect the establishment of neighbor relationships for each protocol?
When you configure router ospf 100, the number 100 is the process ID. The process ID is locally significant to the router and helps the router manage multiple OSPF processes. The process ID does not need to match between routers for them to become neighbors.
- When you configure router eigrp 100, the number 100 is the autonomous system (AS) number. The AS number in EIGRP must match between routers for them to become neighbors.
- If you run router ospf 100 on R1 and router ospf 200 on R2, the routers can still become neighbors. & If you run router eigrp 100 on R1 and router eigrp 200 on R2, the routers will not become neighbors.
LSA’s
OSPF is a Link-State Routing Protocol: Think of OSPF like a GPS. As we know GPS has all the possible routes to reach the destination and among all the possible routes GPS gives you the best route to reach the destination. Similarly, in the case of OSPF, the Router knows all the possible paths to reach the destination but only chooses the best path. This is great because knowing all the paths means it
won’t accidentally send data in a loop.
But, just like calculating a long route on your GPS takes more time and power than a short one, Similarly, OSPF utilizes more CPU than other routing protocols.
Link State:
OSPF routers talk to each other by sending messages called link-state advertisements (LSAs). These LSAs tell other routers about their connections. All routers collect these LSAs to build a big database, called the Link-State Database (LSDB).
OSPF uses the Shortest Path First (SPF) algorithm, also known as Dijkstra’s algorithm, to calculate the shortest path to each network destination based on the LSDB. The result will be stored in the routing table with the best paths to each destination.
Why is it important in OSPF?
Think of an LSA as a message that a router sends to other routers. This message contains important information about the router and its connections.
This is important because it provides:
Complete Network View: With LSAs, every router knows the full layout of the network.
Best Path Calculation: This helps routers find the best path to send data, just like having a full map helps you find the best route on a GPS.
Prevents Loops: Knowing all the connections means routers won’t send data in circles.
Metric Calculation
OSPF uses a metric called “Cost” to decide the best path. The path whose metric is less will be preferred.
Cost = (Reference Bandwidth) / (Link Bandwidth)
By default, OSPF uses a reference bandwidth of 100 Mbps (which is 100,000 kbps).
Link Bandwidth: This is the actual bandwidth of the link, measured in kbps.
Types of links & their Bandwidth:
Ethernet Link – 10 Mbps = 10,000 kbps
Fast Ethernet Link – 100 Mbps = 100,000 kbps
Serial Link – 1.544 Mbps = 1,544 kbps
1 Gigabit Ethernet Link – 1,000 Mbps = 1,000,000 kbps
10 Gigabit Ethernet Link – 10,000 Mbps = 10,000,000 kbps
Note:- you can change the reference bandwidth in OSPF, this is useful if you want to adjust the cost calculations for different link speeds in your network, but Cisco recommends setting the same reference bandwidth on all routers. This makes sure all routers calculate costs in the same way.
Command to change the reference bandwidth:
router ospf [process-id]
auto-cost reference-bandwidth < value > ;Value will be in Mbps.
COST can only have integer values, this would be rounded up to 1.
Router(config-if)# ip ospf cost [cost-value]
Router-ID
Each OSPF router has a unique Router ID (RID), which is like an ID card for the router. The Router ID is a 32-bit number.
- The Router ID must be unique across the OSPF network. If two routers have the same Router ID, they won’t be able to establish a neighborship. Unique RID helps to identify the router and its data base across the OSPF network.
Router ID Election:
Manually Configured: Set it manually.
Highest Loopback Address: If a loopback address is present.
Highest Interface IP Address: If no loopback address is configured.
Default Router ID: If no Router ID is configured, OSPF uses 0.0.0.0 as the default. The Router ID is assigned only once and remains the same until it is manually changed.
The Router ID can be an existing interface IP address, but it does not have to be.
Router-ID vs Process-ID
OSPF routers do not share the Process ID in multicast messages. They rely on the Router ID for identifying and exchanging routing information.
Multiple OSPF processes can run on a single router, but the Router ID remains the same for all processes.
Tables
OSPF maintains three types of tables:
Neighbor Table: Lists all OSPF routers that are neighbors.
Link-State Database (LSDB): Contains information about the network’s topology.
Routing Table: Contains the best routes to different destinations based on the LSDB.
Commands to check the Database
Show IP OSPF Database
Show IP OSPF Database Router
Show IP OSPF Database<RI>
Show ip ospf database network
Area’s
Types of Area’s:
Backbone Area (Area 0): This is the central area of an OSPF network, known as Area 0.
Non-Backbone Areas: All areas other than Area 0 are considered non-backbone areas.
Communication Rule: Non-backbone areas cannot communicate directly with each other. They must pass through the backbone area (Area 0) to exchange routing information.
Types of OSPF Routers:
Backbone Router: A router that has all of its interfaces in the backbone area (Area 0) is called a Backbone Router.
Non-Backbone Router: Non-backbone routers are divided into two types:
ABR (Area Border Router): This router has at least one interface in the backbone area (Area 0) and at least one interface in a non-backbone area. It acts as a gateway between different areas.
ASBR (Autonomous System Boundary Router): This router has interfaces in OSPF and other routing protocols. It connects OSPF to external routing systems and is responsible for route redistribution between OSPF and other protocols.