OSPF
Open Shortest Path FirstOSPF is how routers inside one organisation agree on the shape of it. Every router floods a description of its own links to all the others, so each builds an identical map of the network and then runs Dijkstra on it to find the shortest path to everywhere.
OSPF gives every router the same map of the network — then each computes its own shortest paths from it.
How it works
Because the map is shared rather than summarised, OSPF converges fast and cannot form the loops distance-vector protocols can. A link failure floods one small update and everyone recomputes.
What OSPF does, step by step
Hello packets on each interface find adjacent routers and keep the adjacency alive.
Each router originates LSAs listing its interfaces, their neighbours and the cost of each.
LSAs are reflooded until every router in the area holds an identical link-state database.
Each router runs Dijkstra over that database to build its own routing table — cheapest total cost wins.
In cybersecurity
A routing protocol decides where every packet goes, so a router that is allowed to speak OSPF and shouldn’t be can pull traffic wherever it likes.
Without it, any host that sends Hellos becomes a neighbour — use HMAC-SHA, not the old MD5.
Turn OSPF off on ports facing users; only router-to-router links should carry it.
A rogue router advertising an attractive cost draws traffic through itself.
Flooding excessive LSAs exhausts memory and CPU on every router in the area.
Routes pulled in from BGP or elsewhere should be filtered, or a mistake propagates everywhere.
The topology of your whole network is on the wire in the clear; segment where that matters.