Configuration Guide Vol. 3


11.1.3 Routing algorithm

OSPF uses the SPF (Shortest Path First) algorithm for route selection.

Each router has a database of all routers on which OSPF is running, and all routers-to-routers and router-to-network connectivity. From this database, you configure a topology that has routers and networks as its vertices and a connection between routers and routers and networks as its edges. By applying the SPF algorithm to this topology, the OSPF protocol computes a shortest-path tree that it uses to determine the routes to each vertex and address.

The following figure shows an example network configuration.

Figure 11-1: Example of network configuration

[Figure Data]

The next figure shows a shortest-path tree generated with Router 1 as its root node. It shows the OSPF topology and an example of assigning costs to the routes between vertices. For router-to-network connections, you can configure costs only for connections from routers to the network. Paths leading from networks to routers always have a cost of zero.

The cost to a given destination reflects the total transmission cost of the interfaces that the route traverses. For example, the cost of the route from Router 1 to Network 2 is 6 (Router 1-Network 1) + 0 (Network 1-Router 3) + 2 (Router 3-Network 2) = 8.

Figure 11-2: Shortest tree with root at router 1

[Figure Data]

In OSPF, optimum paths are selected based on cost. If the protocol selects a suboptimal path for a given configuration, you can direct it to select a more suitable path by increasing the cost of the unfavorable network interface, or lowering the cost of more suitable network interfaces. Given that 1 is the minimum cost you can assign, you may need to increase the cost of the interfaces in all other routers if the cost of an interface is already too low. Be careful not to assign too low a cost to the interfaces in a large-scale network in case future optimization requires that the cost of a given interface be reduced.