OSPF: Dynamic routing inside your own network
In short: A routing protocol for larger company networks in which routers exchange their links and compute the shortest paths themselves.
In more detail: OSPF (Open Shortest Path First) is a link-state protocol for the inside of a network (IGP). In the end every router knows the entire network structure of its area and uses the Dijkstra algorithm to calculate the cheapest path to every destination. If a link fails, all routers recalculate and the network usually finds another path within seconds.
In Depth
Link state instead of distance vector
Simple protocols such as RIP only pass on how far away a destination is and count router hops (maximum 15). OSPF instead distributes descriptions of the individual links (link-state advertisements). From all descriptions every router builds the same map and calculates for itself. The cost of a route depends on bandwidth: the faster the line, the lower the cost.
Neighbours and areas
Routers find each other through hello packets and form adjacencies. On networks with several routers a designated router is elected so that not every router has to talk to every other. Large networks are split into areas. Area 0 is the backbone and all other areas attach to it. This keeps the maps small and changes do not affect the whole network.
Example configuration
On a router running FRRouting or similar software, a minimal setup looks like this:
router ospf
network 10.0.0.0/24 area 0
network 10.0.1.0/24 area 0
This includes the interfaces in these networks in OSPF, sends hello packets there and learns the neighbours’ routes.
Distinction
OSPF works within one organisation (autonomous system). Between different operators on the internet BGP is used. For small networks with few routers static routes are enough; OSPF pays off with several sites and redundant paths. IPv6 uses OSPFv3.
See also: Routing, BGP and routing on the internet, Layer 3 switch