Popular Posts

Tuesday, 30 June 2015

OSPF Basic Configuration

As reviewed in the OSPF concepts article, OSPF is a standards-based interior routing protocol that has applications in most interior routing networks. OSPF is very versatile and is supported on a number of different vendors’ equipment lines. This article takes a look at the basic configuration of OSPF on Cisco IOS based equipment as well as shows some examples of how OSPF can be configured in situations where the needs for OSPFs more advanced features is not required.

OSPF Basic Configuration Commands

A number of different Cisco IOS OSPF configuration commands are available, but at its most basic, OSPF configuration uses three commands: the router ospfnetwork, and router-id commands.
  • The router ospf process-id command is the beginning of any Cisco IOS OSPF configuration. It is used to create or modify an existing OSPF routing process and enters the user into OSPF router configuration mode. When configuring OSPF, process-id is used as an identifier of the local OSPF process; different OSPF process IDs would be used on the same router if multiple independent OSPF processes were being run on the same device. These OSPF process IDs are only locally significant and do not have to match from one OSPF device to another (as opposed to EIGRPs Autonomous System (AS) identifiers).
  • The router-id command is used to statically configure the OSPF router-id; this router-id is used to identify the OSPF device to the other devices in the OSPF network. This router-id must be unique for each OSPF device; without the configuration of the router-id, it will be selected based on the following order: highest loopback interface, highest active (up/up) physical interface. The configuration of either a loopback interface or the use of the router-idcommand is very common in OSPF implementations as it makes the identification of specific OSPF devices easier.
  • The network command is used to identify which device interface will be included within the OSPF process and to what area the interface will be assigned to. The correct usage of thenetwork command is vital for the operation of the OSPF network. The full command is:network ip-address wildcard-mask area area-id; often the wildcard-mask is a stumbling point of configuration as it is written the opposite of common subnet mask notation. For example, the subnet mask 255.255.255.0 would be identified with a wildcard-mask of 0.0.0.255. Thearea-id portion of the command is used to assign an interface (and the network it represents) into a specific OSPF area; OSPF areas are used to provide hierarchy to the routing network.

OSPF Basic Configuration

The basic configuration of OSPF is not all that complicated once an understanding of the different OSPF commands exists. Table 1 shows the steps that are involved to configure a basic OSPF network:

Table 1
OSPF Basic Configuration

1
Enter global configuration mode.
router#configure terminal
2
Create an OSPF routing process and enter router configuration mode.
router(config)#router ospf process-id
3
Configure the interfaces that OSPF will be enabled on.
router(config-router)#network network wildcard-mask area area-id
Another thing that is often overlooked when configuring routing protocols is the inclusion of interfaces into a routing protocol process without sending advertisements out the interface. On most networks, segments exist that contain a number of hosts but do not include any other routing protocol devices; in these situations, it is not necessary to send routing protocol traffic out the interface as it is not required and can be used by malicious users to map out the internals of the network. In these situations it is best to configure these interfaces as passive; this label will disable routing protocols advertisements from exiting the interface. Table 2 shows the steps that are involved to configure an interface as passive:

Table 2
OSPF passive-interface Configuration

1
Enter global configuration mode.
router#configure terminal
2
Enter EIGRP router configuration mode.
router(config)#router ospf process-id
3
Configure an interface as passive.
The default parameter can be used to change the default behavior so that all interfaces are passive by default. In this situation, an interface is configured as not passive with the no passive-interfaceinterface-type interface-number command.
router(config-router)#passive-interface[default] interface-type interface-number

OSPF Basic Configuration Examples

Figure 1 OSPF Configuration Example Topology
As discussed above, the basic configuration of OSPF is rather simple. A basic network is flat and includes all OSPF devices into a single area. Since OSPF must have a backbone area (Area 0), it makes sense to include all of the devices within this area. With the network shown in Figure 1, there are two different ways to configure the network command depending on the intentions of the design engineer. The first is to individually configure a network statement for each IP subnet; the configuration for this is shown in Table 3:

Table 3
OSPF Basic Configuration— Individual network statements

1
Enter global configuration mode.
router#configure terminal
2
Enter EIGRP router configuration mode.
router(config)#router ospf 10
3
Configure a network statement for the F0/0 interface.
router(config-router)#network 172.16.100.0 0.0.1.255 area 0
4
Configure a network statement for the F0/1 interface.
router(config-router)#network 172.16.50.128 0.0.0.127 area 0
5
Configure a network statement for the F0/2 interface.
router(config-router)#network 172.16.1.0 0.0.0.255 area 0
The other method that is commonly seen is to include all networks on a device into a single networkstatement. This can be done when there are multiple interfaces on a device that can be included into a single statement. For the topology shown in Figure 1, all of the networks can be included into a single network statement as shown in Table 4:

Table 4
OSPF Basic Configuration— Single network statement

1
Enter global configuration mode
router#configure terminal
2
Enter EIGRP router configuration mode
router(config)#router ospf 10
3
Configure a network statement for the F0/0 interface
router(config-router)#network 172.16.0.0 0.0.255.255 area 0
Keep in mind that the OSPF network statement only includes the interfaces on the configured device that match the network/wildcard mask pair; it does not advertise via OSPF that this device knows all routes to the whole 172.16.0.0/16 network, only the networks that match the network statement on this specific device. What this effectively means is that both configurations end up with the exact same OSPF function; the selection of one over the other is simply a matter of engineer preference.

Summary

Hopefully the content of this article will get you started in understanding of basic OSPF configuration. Take the concepts shown in this article and test them in a lab or via a product like dynamips (dynagen or GNS3). Once these concepts have been tested and understood, take a look at the next advanced OSPF configuration article (linkto) that covers some more advanced situations that OSPF can be configured for.

No comments: