How to Run OSPF on Junos Devices
OSPF is an advanced interior gateway routing protocol. OSPF is a link-state protocol. Instead of determining the best route by looking at the distance (number of hops), link-state protocols run a shortest-path first (SPF) algorithm to create a database of the network’s topology and, from that database, to determine the best (that is, shortest) path to a destination.
The nice thing about OSPF is that not only can hops be used as metrics, but you can set OSPF to determine the best path. The best path might use the fewest number of hops or the highest bandwidth links, while using one route for multicast and another for regular unicast packets. Setting up multi-topology OSPF routing is a lot of work, but doing so is often worth the effort.
As an IGP, OSPF operates within a single network administrative boundary or domain, which is sometimes called an autonomous system (AS).
Each router running OSPF goes through the following process to discover the network topology and determine the best path to each destination:
OSPF creates link-state advertisements (LSAs), which describe the network topology that the router has in its link-state database.
The router floods the LSAs to all routers in the domain.
When the router receives LSAs from other routers, it adds the information to its link-state database.
The router runs the Dijkstra SPF calculation to determine the shortest path to each destination in the domain.
The result of the calculation is a pair of values for each destination, consisting of the destination address and the next hop toward that destination. OSPF places this information in its OSPF routing database.
Although each router performs the SPF calculation independently, all routers end up with identical link-state databases (though the routers may have different next hops for the destinations). Another way to look at it is that OSPF routers all have essentially the same routing table information, but derive distinct forwarding tables.
All OSPF routers within a domain must have the same link-state databases for OSPF to work.
When changes occur in the administrative domain, this information is transmitted in LSAs, and all the OSPF routers rerun the SPF calculation and update their link-state databases.