Network Statements, Part 8

Let’s continue with our discussion of techniques involving network statements and OSPF.

As we previously discussed, we can get all of the interfaces running OSPF process 1 in Area 0 like this:

router ospf 1

network 0.0.0.0 255.255.255.255 area 0

Another option is to assign the interfaces (or subinterfaces) to OSPF areas directly. For example, to get all of our interfaces running OSPF with process ID 1 in Area 0, we could do this:

interface fa0/0

ip address 192.168.1.1 255.255.255.0

ip ospf 1 area 0

interface fa0/1

ip address 10.2.2.1 255.255.255.248

ip ospf 1 area 0

interface fa0/2

ip address 172.16.1.1 255.255.255.0

ip ospf 1 area 0

interface fa0/3

ip address 10.1.1.1 255.255.255.0

ip ospf 1 area 0

router ospf 1

Note that along with the interface statements (“ip ospf 1 area 0”) the process must be created (“router ospf 1”), as well. The order in which these are done is not critical.

The question is “Which method is better for configuring OSPF, using network statements, or doing it directly on the interfaces?” The answer (of course) is, “It depends!”

Obviously, if you want to get all of the interfaces (and/or subinterfaces) running an OSPF process in a single area, the network statement approach is faster. On the other hand, some people do not like wildcard masks (if you can imagine that!), and prefer to configure OSPF directly on the interfaces.

In fact, you can combine the two approaches, which allows additional flexibility. If you specify an OSPF area directly on an interface and also cover that same interface with an OSPF network statement, the interface command takes precedence:

interface fa0/1

ip address 10.2.2.1 255.255.255.248

ip ospf 1 area 1

interface fa0/3

ip address 10.1.1.1 255.255.255.0

ip ospf 1 area 1

router ospf 1

network 0.0.0.0 255.255.255.255 area 0

This has the result of running OSPF Area 1 on the two network 10.0.0.0 interfaces, and Area 0 on the others. A possible disadvantage to mixing the methods is that people who are proficient with OSPF network statements may overlook the interface configuration commands (they may not even know that the method exists), and people who know and use the per-interface commands might not check for network statements. You can always verify which interfaces are assigned to which areas with “show ip ospf interface”.

By the way, when configuring IS-IS for IPv4 or any IGP for IPv6, the per-interface method is all that’s available … network statements are not an option for those routing protocols.

Next time, we’ll take a look at how network statements function when used with BGP.

In this article

Join the Conversation