OSPF Network Topology
OSPF works best in a hierarchical routing environment. The first and most important decision when designing an OSPF network is to determine which routers and links are to be included in the backbone (area 0) and which are to be included in each area. The following are three important characteristics to OSPF and its need for a hierarchical routing structure:
Several important items to consider when designing the topology for an OSPF network (discussed at length in the sections that follow) are as follows:
The Number of Routers in an Area
OSPF uses the CPU-intensive SPF algorithm. Experience has shown that 40 to 50 routers per area is the optimal upper limit for OSPF. The number of calculations that must be performed by the router given n link-state packets (LSPs) is proportional to n log n. As a result, the larger and more unstable the area, the greater the likelihood for performance problems associated with OSPF routing recalculation.
Generally, an area should have no more than 50 routers. That does not mean that networks with 60 or 70 routers in an area wont function, but why experiment with stability if you dont need to? Areas with unstable links should be smaller.
One of the main problems with areas is that network administrators let their backbone area grow too large. Try to outline the logical view of the network from the start, and remember that it doesnt hurt to start creating that other area before it is needed. A good rule of thumb is to plan for maximum growth coupled with long term planning. This has the added benefit of ensuring your network can handle rapid growth. In this case, planning for too much is never a bad thing to do.
However, those recommendations are made in accordance with official Cisco recommendations regarding OSPF networks. Studies and real world implementations have gone further. For example, the statistics in Table 5-1 came from the IETF OSPF Standard Report.
It is good to know that OSPF has been thoroughly tested and can withstand scaling to a phenomenal size.
The Number of Areas Connected to an Area Border Router
ABRs will keep a copy of the database for all areas they service. If a router is connected to five areas, for example, it will have to keep a list of five different databases. It is better not to overload an ABR; you should try to spread the areas over other routers. The ideal design is to have each ABR connected to two areas only, the backbone, and another area, with three areas being the upper limit. Figure 5-2 shows the difference between one ABR holding five different databases, including area 0 (part a) and two ABRs holding three databases each (part b).
These are just guidelines; the more areas you attach per ABR, the lower the performance you get from that router. In some cases, the lower performance can be tolerated, but end users probably wont see it that way.
The Number of Neighbors for Any One Router
OSPF floods all link-state changes to all routers in an area. Routers with many neighbors have the most work to do when link-state changes occur. In general, any one router should have no more than 60 neighbors.
The number of routers connected to the same LAN is also important. Each LAN has a DR and BDR that build adjacencies with all other routers. The fewer neighbors that exist on the LAN, the smaller the number of adjacencies a DR or BDR have to build. You can see in Figure 5-3 that the more neighbors the DR or BDR has, the more work they must do.
This, of course, depends on how much processing power your router has. You could always change the OSPF priority to select your DR. Also, if possible, try to avoid having the same router be the DR on more than one segment. If DR selection is based on the highest RID, then one router could accidentally become a DR over all segments to which it is connected. This router would be doing extra effort while other routers are idle.
The Number of Areas Supported by Any One Router
A router must run the link-state algorithm for each link-state change that occurs for every area in which the router resides. Every area border router is in at least two areas (the backbone and one area). In general, to maximize stability, one router should not be in more than three areas.
Selecting the Designated Router
In general, the DR and BDR on a LAN have the most OSPF work to do. It is a good idea to select routers that are not already heavily loaded with CPU-intensive activities to be the DR and BDR. This can be accomplished using the ip ospf priority [priority] command, which will allow you to organize the DRs as needed.
In addition, it is generally not a good idea to select the same router to be the DR on more than one LAN simultaneously. These guidelines will help ensure that no single broadcast link will have too many neighbors with too much hello traffic.