OSPF is the routing protocol that lets routers build a full map of the network and pick the fastest path on their own. It is the one dynamic routing protocol the CCNA exam covers in depth. Here is how it works.
Published 28 November 2026 • SHM Soft
When a packet needs to cross a large network, it passes through several routers. Each router must decide where to send it next. On a small network, a person can type those decisions in by hand. On a large network, that is impossible. The routers need a protocol that lets them learn the network and choose paths on their own.
OSPF is that protocol for most enterprise networks. OSPF stands for Open Shortest Path First. It is open, which means any vendor can use it, and it finds the shortest path first, using a clever algorithm. In this guide, we explain what OSPF is, how it works, and why it matters for the CCNA exam.

OSPF is a link-state routing protocol. That is a fancy way of saying that every OSPF router builds a complete map of the network, and then each router works out the best routes from that map on its own. This is different from distance-vector protocols like RIP, where routers only tell their neighbours what they have heard, like a rumour passed along a line. With OSPF, everyone has the same map, so everyone agrees on the best path.
The map is built from link-state advertisements, or LSAs. Each router tells the others about its own links: which networks it connects to, and what those links cost. The routers flood these messages through the network until every router has the full picture. Then each router runs Dijkstra's shortest path first algorithm on the map and fills in its routing table.
OSPF measures the best path by cost, not by hop count. The cost of a link is based on its bandwidth. A fast link costs less than a slow link. By default, Cisco calculates cost as 100 Mbps divided by the link bandwidth, so a 100 Mbps link costs 1 and a 10 Mbps link costs 10. The router adds up the costs along each possible path and picks the lowest total.
OSPF neighbours and adjacencies
Before routers can share their maps, they must become neighbours. OSPF routers send Hello packets every 10 seconds on most networks, using the multicast address 224.0.0.5, which all OSPF routers listen to. When two routers hear each other's Hellos and agree on a few settings, they become neighbours. Then, on most network types, they go one step further and become adjacent, which means they fully exchange their link-state databases.
For two routers to become neighbours, several things must match: the area number, the Hello and Dead timers, the subnet, the authentication settings, and the area type. The router ID must also be unique. If any of these do not match, the routers will not form a neighbour relationship, and routes will never be exchanged. That is why neighbour problems are the first thing to check when OSPF is not working, and our guide to network troubleshooting commands shows the commands to use. A quick look at the neighbour table usually shows whether the relationship formed or not.
OSPF areas
OSPF splits large networks into areas. Area 0 is the backbone, and every other area must connect to it, directly or through a virtual link. Each area keeps its own detailed map, and only summaries cross between areas. This keeps the routing tables small and limits how far a change spreads when a link fails. A small network usually has just one area, area 0, and that is what the CCNA asks you to configure. Larger networks use many areas, and the routers that sit between them are called Area Border Routers.
OSPF picks routes in a strict order. First, it prefers routes inside its own area. Then it prefers routes from other areas. Then it prefers external routes, which are routes learned from another protocol like BGP or from a static route that was redistributed into OSPF. Inside each group, the lowest total cost wins. If two paths have exactly the same cost, OSPF can use both and share the traffic between them, which is called equal-cost load balancing.
The router ID plays a part too, but not in picking routes. The router ID is a unique number that identifies the router, usually the highest IP address on a loopback interface, or the highest IP on an active interface if there is no loopback. It matters most in elections. On a broadcast network like Ethernet, the routers elect a Designated Router, or DR, and a Backup Designated Router, or BDR. The DR is the one router that collects LSAs from everyone and passes them on, which keeps the chatter down. The router with the highest priority wins, and if priorities tie, the highest router ID wins.
Convergence speed is one of OSPF's strengths. When a link goes down, the routers that notice it send out new LSAs right away. Every router recalculates its routes from the updated map. On a well-designed network, this takes seconds, not minutes. Compare that with RIP, which can take minutes to settle, and you can see why OSPF replaced it almost everywhere.
OSPF behaves differently depending on the kind of link it runs on. On a broadcast network, like Ethernet, routers discover each other with multicast Hellos and elect a DR and BDR. On a point-to-point link, like a direct connection between two routers, there is no election, because there are only two routers and they just talk to each other. These two types cover almost everything you will see in a lab or on the CCNA exam.
There are other types, like non-broadcast and point-to-multipoint, which were built for older technologies like Frame Relay. You are unlikely to meet them in a modern network, but the CCNA still mentions them. The key point is simple: the network type changes how neighbours are found and whether an election happens.
OSPF also comes in versions. OSPFv2 works with IPv4, and OSPFv3 works with IPv6, with some differences in how it is configured. The CCNA focuses on single-area OSPFv2, which means one area, area 0, with IPv4. Learn that well, and OSPFv3 will feel familiar when you meet it.

OSPF and EIGRP are the two main interior routing protocols you will hear about. OSPF is an open standard, so it runs on routers from any vendor. EIGRP started as a Cisco-only protocol, though it was later published as an open standard. In a network with mixed vendors, OSPF is the safe choice, and it is the one most enterprises use.
EIGRP is often faster to converge, because it keeps backup routes ready to use. OSPF has to recalculate from the map, which takes a little longer. But OSPF scales better to very large networks, thanks to areas, and it is the protocol the CCNA exam tests in depth. EIGRP appears on the exam too, but only at a basic level. If you are studying, learn OSPF properly and learn EIGRP's main ideas as well. Our guide on TCP/IP vs the OSI model explains where routing protocols sit in the stack, which helps the whole picture make sense.
In practice, most networks pick one and stick with it. Mixing two routing protocols in one network is possible, but it adds complexity, and it is usually done only during a migration. If you inherit a network, find out which protocol it runs before you change anything.
Watch on YouTube: Free CCNA | OSPF Part 1 | Day 26 | CCNA 200-301 Complete Course
A basic OSPF configuration
Configuring single-area OSPF on a Cisco router takes three steps. First, turn OSPF on with a process ID, like router ospf 1. The process ID is local to the router, so neighbours can use different ones. Second, tell OSPF which interfaces to run on, with a network statement and a wildcard mask, like network 192.168.1.0 0.0.0.255 area 0. Third, check your work with show ip ospf neighbor and show ip route ospf. If the neighbours show up and the routes appear, it works.
Two details trip people up. First, the network statement uses a wildcard mask, not a subnet mask. For a /24 network, the wildcard mask is 0.0.0.255, which is the subnet mask subtracted from 255.255.255.255. Second, the area number must match on both sides of a link. If one router says area 0 and the other says area 1, they will never become neighbours, and the problem will not be obvious until you check the neighbour table.
OSPF is one of the biggest topics on the CCNA exam, so it deserves real lab time. Build a three-router triangle in Packet Tracer, turn on OSPF, break a link, and watch the routes change. That one exercise teaches more than an hour of reading. And if you want a plan for the whole exam, our guide on how to pass the CCNA puts OSPF practice in the weekly schedule where it belongs.
What is OSPF in simple terms?
OSPF is a routing protocol that lets routers build a map of the network and pick the fastest path to each destination on their own. It is an open standard, it works on any vendor's routers, and it reacts quickly when links fail.
What does OSPF stand for?
OSPF stands for Open Shortest Path First. Open means it is an open standard. Shortest Path First is the algorithm it uses, Dijkstra's algorithm, to work out the best route from the network map.
What is the difference between OSPF and BGP?
OSPF routes inside one organisation's network, while BGP routes between different organisations on the internet. OSPF is fast and detailed. BGP is slower and policy-driven, because it has to respect business agreements between networks.
What is OSPF area 0?
Area 0 is the backbone area of OSPF. Every other area must connect to area 0. It is the hub that all inter-area traffic passes through. Small networks often have only area 0, which is called single-area OSPF.
How does OSPF calculate cost?
By default, Cisco calculates OSPF cost as 100 Mbps divided by the link bandwidth. A 100 Mbps link costs 1, a 10 Mbps link costs 10, and a 1 Gbps link costs 1 as well, because the cost cannot go below 1. The router picks the path with the lowest total cost.
Conclusion
OSPF is the workhorse of enterprise routing. Every router builds the same map, every router calculates its own best paths, and when something breaks, the whole network adapts in seconds. It costs nothing to run, it works on any vendor's hardware, and it scales from a three-router lab to a global network through areas.
If you are learning networking, OSPF is worth your time. Learn the neighbour process, learn areas, learn cost, and practise the configuration until it feels easy. It is one of the most tested topics on the CCNA, and it is one of the most useful protocols you will ever configure.
Related articles:
What Is EIGRP? How It Works and EIGRP vs OSPF
Cisco's fast-converging routing protocol, and how it compares with OSPF.
What Is BGP? Border Gateway Protocol Explained
The protocol that routes between networks on the internet, and how it differs from OSPF.
TCP/IP vs OSI Model: A Layer-by-Layer Comparison
Where routing protocols sit in the stack, and how the two models map to each other.
Want a clear price for your project?
Tell us what you need and we will send a free quote with no hidden charges.