Activating OSPF

As with other routing protocols, the enabling of OSPF on Cisco routers requires taking the following preliminary steps before the process begins:

1 Determine the process ID under which OSPF is to run within your network. This process ID must be different from any other OSPF network to which you might be connecting. The possible range for an OSPF process ID is 1-65535.

2 Specify the range of addresses that are to be associated with the OSPF routing process. This is part of one command that must also include the area with which this range of addresses is to be associated.

Now that you have determined how the OSPF process should be configured, you need to start configuring the router. Perform the following tasks, starting in global configuration mode:

Step 1 Enable OSPF routing, which places you in router configuration mode. You do this with the following command:

HAL9000(config)#router ospf ? <1-65535> Process ID

Step 2 Define the interface or interfaces (via the network command) on which you want to OSPF run, and define the area ID for that interface. You do this with the following command:

HAL9000(config)#router ospf 100 HAL9000(config-router)#network ? A.B.C.D Network number

HAL9000(config-router)#network 10.10.10.0 0.0.0.255 area 10

272 Chapter 5: Routing Concepts and Configuration

In this example, using the network command with a 24-bit inverse mask places all interfaces within that range assigned to the router in area 10. The following section discusses the network command in more detail. If this were an internal OSPF router, the process for configuring it for OSPF would now be complete. There are a few subtle differences when configuring the different types of OSPF routers, as described in the next few sections.

network Command

The network command activates OSPF per interface; however, you can define this as a network entry or as a host address—the choice is yours. Specifically, that means a mask of 255.255.255.0 (/24), expressed in the OSPF network command as 0.0.0.255, activates all interfaces within that range for OSPF to use. With this command, the mask entry uses the wildcard (inverse) style mask.

Some people prefer to keep configuration as simple, as follows:

network 10.10.10.1 0.0.0.0 area 0 This command tells the router that only the interface address 10.10.10.1 is in area 0. That is simpler because it keeps the mask 0.0.0.0, and you just specify each interface address. Of course, this involves a lot more typing on a router with many interfaces. To avoid repetitive typing and configure smarter rather that harder, consider the following example.

Suppose that you have a large router with many interfaces in OSPF. This might be a core router, and you want to place all the interfaces into OSPF area 0 with one command. All router interfaces fall within the range 10.10.31.0 to 10.10.95.0, so you want to place the entire range into OSPF. Use the following commands:

HAL9000(config)#router ospf 100

HAL9000(config-router)#network 10.10.0.0 0.0.31.255 area 0

This syntax accomplishes the result you need; however, to understand why, review the binary form to see how this command is interpreted by the router:

In this example, all router interfaces in the range 131.108.64.0 to 131.108.95.255 should be in area 0.

When you experiment with OSPF, there can be order sensitivity to the commands. The problem seems to be that if you configure network..., then no network ..., then network <something else>, the router might not re-initialize OSPF on the relevant interfaces—so it doesn't send Hellos and doesn't form adjacencies. The solution is to either save your configuration and reboot the router (drastic) or to use a Windows PC cut-and-paste operation to copy the router ospf part of the config, do no router ospf 1 to stop OSPF, and then paste the correct config back in. Who said Windows had no redeeming value!

NOTE shut/no shut on an interface fixes this as well but remember to let it be shut down long enough for all the OSPF timers to expire.

Was this article helpful?

0 0

Post a comment