Starting OSPF
You enable OSPFv2 and OSPFv3 differently. When you enable OSPFv2 on your router, you can create either a range of OSPFv2 interfaces or a single OSPFv2 interface. When enabling OSPFv3, you create the OSPFv3 interface and assign the interface to an area.
Enabling OSPFv2
You can create OSPFv2 interfaces in the following ways:
- You can issue the network area command, which creates OSPF interfaces for all IP interfaces with IP addresses within the specified range.
- You can issue the address area command, which creates an OSPF interface in the specified area that sits on top of the IP interface at the given IP address (or on the unnumbered interface, if that is specified).
NOTE: Do not enable OSPF on any unidirectional interfaces (such as an MPLS tunnel), because it can never form an adjacency.
You can delete OSPFv2 interfaces in the following ways:
- You can issue the no network area command, which deletes all OSPF interfaces within the specified range.
- If the OSPF interface was created with the address area command, you can issue the no address area command to delete the specified interface.
- You can issue the no ip address command to delete the IP interface associated with the OSPF interface and also the OSPF interface itself.
Enabling OSPFv3
NOTE: Before you can enable OSPFv3, you must specify an IPv6 license key. For additional information about configuring an IPv6 license key, see Configuring an IPv6 License.
OSPFv3 provides IPv6 support in the OSPF protocol. To enable OSPFv3:
- Issue the ipv6 router ospf command, and specify a process ID.
- Use the router id command to specify a router ID for OSPFv3.
See Specifying an OSPF Router ID.
- Issue the ipv6 ospf area command (in interface configuration mode) to create an OSPFv3 interface under an area ID.
You can delete OSPFv3 interfaces in the following ways:
- You can issue the no ipv6 router ospf command, which deletes OSPFv3.
- You can issue the no ipv6 ospf area command to remove the OSPF interface from a specific area.
Creating a Range of OSPF Interfaces
To create a range of OSPFv2 interfaces:
- Create an OSPF routing process.
- Create the range of IP addresses associated with the routing process and the corresponding OSPF interfaces.
- Assign an area ID associated with each range of IP addresses.
Each router running OSPFv2 has a database describing a map of the routing domain. This map needs to be identical in all participating routers.
network area
- Use to configure a range of OSPFv2 interfaces and their related area.
- If the specified range matches one or more of the IP addresses configured for IP interfaces, one or more corresponding OSPF interfaces are created and placed in the specified area.
- Create address ranges that do not overlap; you can attach only the same range of interfaces to a single area.
- You cannot use this command for unnumbered interfaces.
- If the range specified by this command includes an address on an interface that is being referred to by unnumbered interfaces, all of the unnumbered interfaces begin trying to form adjacencies. If this behavior is not intended, you must reevaluate the interface assignment or the range specified by the command.
- Example 1shows the creation of one OSPF interface in the backbone area
host1(config-if)#ip address 2.2.2.1 255.255.0.0host1(config-if)#ip address 2.2.1.1 255.255.0.0 secondaryhost1(config)#router ospf 2host1(config-router)#network 2.2.2.0 0.0.0.255 area 0Example 2shows the creation of two OSPF interfaces, one in the backbone area and one in a non-backbone area host1(config-if)#ip address 2.2.2.1 255.255.255.0host1(config-if)#ip address 2.2.1.1 255.255.255.0 secondaryhost1(config)#router ospf 2host1(config-router)#network 2.2.2.0 0.0.0.255 area 0host1(config-router)#network 2.2.1.0 0.0.0.255 area 1This sequence of commands creates two OSPF ranges (2.2.2.0/24 and 2.2.1.0/24), with each range belonging to a different area. Area 0 is configured for 2.2.2.0/24, and area 1 is configured for 2.2.1.0/24. This sequence also creates two OSPF interfaces: one in the backbone area (area 0) using IP address 2.2.2.1, the second in a nonbackbone area (area 1) using IP address 2.2.1.1. This command also creates the two areas if they do not already exist.
- Use the no version to delete OSPF interfaces, ranges, and areas.
NOTE: Until you activate the configured network range for summaries by issuing the area range command, the range is not active for summarization; the network range is summarized through area summariesfor ABRs only. (See Aggregating OSPF Networks.) The only range that is active by default if you do not issue the area range command is the network that matches the IP interface's network exactly. (In other words, by default the exact network of the IP interface is going to be summarized into other areas.)
ospf enable
host1(config-router)#ospf enableThe no version of this command is deprecated and may be removed in a future release. Use the ospf shutdown command to disable OSPF on the router. router ospf
- Use to set an OSPF process ID.
- The process ID can be any positive integer in the range 165535.
- You must assign a unique ID for the OSPF routing process.
- From a virtual router context you can specify a VRF name (OSPFv2 only). Doing so changes the context to that of the specified VRF and remains so until you exit from the OSPFv2 router context.
- Example 1
host1(config)#router ospf 5Example 2 host1(config)#ipv6 router ospf 5Use the no version to end the designated OSPF routing process. Creating a Single OSPFv2 Interface
To create a single OSPFv2 interface:
- Create an OSPF routing process.
- Create the OSPF interface associated with the IP interface at the specified address.
Each router running OSPF has a database describing a map of the routing domain. This map needs to be identical in all participating routers.
address area
- Use to create an interface in an area on which OSPFv2 runs, on top of the IP interface at the specified IP address.
- You can specify either an IP address or an unnumbered interface.
- Configures OSPFv2 with the default values. You can configure the interface with a nondefault value by using the other address commands. You must first issue the address area command before issuing any other address commands. See Configuring OSPF Interfaces for more information.
- Example
host1(config-router)#address 10.10.32.100 area 0.0.0.0Use the no version to delete the OSPFv2 interface. ospf enable
host1(config-router)#ospf enableThe no version of this command is deprecated and might be removed in a future release. Use the ospf shutdown command to disable OSPF on the router. router ospf
- Use to set an OSPF process ID.
- The process ID can be any positive integer in the range 165535.
- You must assign a unique ID for each OSPF routing process.
- Example
host1(config)#router ospf 5Use the no version to end the designated OSPF routing process. Specifying an OSPF Router ID
The router ID is typically derived by each router from its interface IP addresses. However, you can use the router-id command to specify a different router ID for OSPF.
router-id
host1(config-if)#router-id 192.168.50.5Use the no version to force OSPF to use the previous OSPF router ID behavior.