OSPF can be enabled on a router via two methods, a network statement or via interface specific configuration.
OSPF Network Statements
Entering an OSPF network statement into the router configuration will try match the interfaces that will partake in the OSPF process by their primary interface addresses.
Secondary addresses on an interface can be inserted into the OSPF link state database by including them on a separate network statement under the same area as the primary interface.
When an interface is matched by the network statement, it will advertise the network into OSPF, and activate the OSPF process on that interface. This allows the interface to form OSPF adjacencies with other routers for that network.
The configuration of the OSPF network statement is similar to that of EIGRP, except an area number is specified.
If multiple network statements match the same interface, then it is the most specific network statement that will be apply to associate an interface with the configured area.
To configure a network interface of 192.168.1.254 with OSPF into area 0, enter the following commands:
router ospf 1 network 192.168.1.0 0.0.0.255 area 0
OSPF Interface Configuration
The interface specific configuration allows OSPF to be configured and enabled directly from an sub-interface.
Some network administrators may prefer this more specific configuration, but as the number of interfaces increase it may be more organised to keep the OSPF configuration in a central place under
Interface specific OSPF settings take priority over centralised settings in
An example of configuring OSPF specifically on an interface:
interface FastEthernet0/0 ip address 192.168.1.254 255.255.255.0 ip ospf 1 area 0