Configuring OSPF Interfaces
You can configure OSPF attributes for either a single OSPF network by using the address commands, or for all OSPF networks on a particular media interface by using the ip ospf commands.
The size of the OSPF maximum transmission unit (MTU) is negotiated rather than configured. OSPF database description exchange uses the interface MTU to signal the largest OSPF MTU that can be sent over an OSPF interface without fragmentation.
Configuring OSPF attributes for OSPF networks includes setting the following:
- Cost
- Dead interval
- Hello interval
- Router priority
- Retransmit interval
- Transmit delay
NOTE: Before using the address or ip ospf commands, see Precedence of Commands for information about the relationship between these commands.
address Commands
You can use the address area command to create a new OSPF interface. Use the other address commands to configure parameters for OSPF interfaces that already exist.
The address commands configure OSPF attributes for a single OSPF network. The ip ospf commands configure OSPF attributes for all OSPF networks in the given interface contextfor example, in a multinet environment where multiple IP networks sit on top of an Ethernet interface.
NOTE: You must first issue the address area command before issuing any other address command.
address area
- Use to create a new OSPF interface and configure the area ID.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address 10.12.10.2 area 3You must first issue the address area command before issuing any other address commands. Use the no version to delete the area ID from the specified interface. address cost
- Use to specify the cost metric for the interface. The cost is used in calculating the SPF routing table and can be in the range 065535.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address unnumbered atm 4/0.1 area 3host1(config-router)#address unnumbered atm 4/0.1 cost 50Use the no version to reset the path cost to the default value, 1. address dead-interval
- Use to specify the time period for the router's neighbors to wait without seeing hello packets from the router before they declare the router to be down.
- The dead interval can be in the range 02147483647 seconds, and is advertised by the router's hello packets.
- For the OSPF routers to become adjacent, the dead interval must be identical on each router.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address 192.168.10.32 area 6host1(config-router)#address 192.168.10.32 dead-interval 60Use the no version to reset the dead interval to the default value, 40 seconds. address hello-interval
- Use to specify the interval between hello packets that the router sends on the interface.
- The hello interval can be in the range 165535 seconds.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address 192.168.1.1 area 5host1(config-router)#address 192.168.1.1 hello-interval 25Use the no version to reset the hello interval to the default value, 10 seconds. address passive-interface
- Use to disable the transmission of routing updates on the interface, meaning that OSPF routing information is neither sent by nor received through the interface.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address 192.168.100.20 area 5host1(config-router)#address 192.168.100.20 passive-interfaceUse the no version to reenable the transmission of routing updates. address priority
- Use to specify the router priority, an 8-bit number in the range 1255. Used in determining the designated router for the particular network.
- Applies only to nonbroadcast multiaccess (NBMA) networks. Every broadcast and NBMA network has a designated router.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address unnumbered loopback 0 area 6host1(config-router)#address unnumbered loopback 0 priorityUse the no version to restore the default value, 1. address retransmit-interval
- Use to specify the time between LSA retransmissions for the interface when an acknowledgment for the LSA is not received.
- Specify an interval in the range 03600 seconds; the default value is 5.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address 192.168.10.200 area 6host1(config-router)#address 192.168.10.200 retransmit-interval 500Use the no version to restore the default value, 5 seconds. address transmit-delay
- Use to specify the estimated time it takes to transmit a link-state update packet on the interface.
- Specify an interval in the range 03600 seconds; the default value is 1.
- The interface can have an IP address, or it can be unnumbered.
- Example
host1(config-router)#address 10.100.25.38 area 7host1(config-router)#address 10.100.25.38 transmit-delay 30Use the no version to restore the default value, 1 second. ip ospf and ipv6 ospf Commands
The ip ospf commands have two effects on interface configuration. These effects apply to all ip ospf commands:
The ip ospf command configures the specified OSPF parameters for all networks configured on the given IP interfacefor example, all multinetted addresses on an interface.
The no version of the command resets the specified parameters to unspecified.
If the no version of the command takes effect for a specified IP interface, there is no default value for the specified parameters. The parameter is set back to unspecified values. However, the value of the specified parameter for the OSPF interface is set back to the default value or the value previously specified by the address command.
The ip ospf command configures the specified OSPF parameters for each OSPF interface that sits on top of the IP interface.
The no version of the command restores the specified parameters to the default values.
NOTE: We recommend using address commands to set attributes of OSPF interfaces created using the address area command.
ipv6 ospf area
- Use to create an OSPFv3 interface under the specified area ID or move the OSPFv3 interface from its current area to the specified area.
- Specify an optional process ID in the range 165535.
- Example
host1(config)#interface fastethernet 0/0host1(config-if)#ipv6 ospf area 50Use the no version to remove this interface from the specified area. ip ospf cost
- Use to configure the cost of sending a packet on the network.
- Cost is a metric value in the range 065535; the default value is 1.
- The router LSA advertises the link-state metric as the link cost.
- For the IPv6 command, you can specify an optional process ID in the range 165535.
- Example 1
host1(config)#interface fastethernet 0/0host1(config-if)#ip ospf cost 50Example 2 host1(config)#interface fastethernet 0/0host1(config-if)#ipv6 ospf cost 50Use the no version to reset the path cost to the default value, 1. ip ospf dead-interval
- Use to configure the interval since the last hello packet was seen.
- Specify an interval in the range 02147483647 seconds; the default value is 40 seconds.
- For the OSPF routers to become adjacent, the dead interval must be identical on each router.
- The router's hello packets advertise this interval.
- For the IPv6 command, you can specify an optional process ID in the range 165535.
- Example 1
host1(config-if)#ip ospf dead-interval 60Example 2 host1(config-if)#ipv6 ospf dead-interval 60Use the no version to restore the default value, 40 seconds. ip ospf hello-interval
- Use to configure the interval between hello packets.
- Specify an interval in the range 165535 seconds; the default value is 10 seconds.
- For the OSPF routers to become adjacent, the hello interval must be identical on each router.
- For the IPv6 command, you can specify an optional process ID in the range 165535.
- Example 1
host1(config-if)#ip ospf hello-interval 8Example 2 host1(config-if)#ipv6 ospf hello-interval 8Use the no version to restore the default value, 10 seconds. ipv6 ospf mtu-ignore
- Use to specify that the interface disregard the MTU size contained in the data description packet.
- When enabled, the interface accepts data description packets from its neighbor even if it has a different MTU size (the MTU size must be less than 18000).
- Specify an optional process ID in the range 165535.
- Example
host1(config-if)#ipv6 ospf mtu-ignoreUse the no version to reset the default: that the neighbor MTU size must match the MTU size of the OSPFv3 interface from which the packet is received. ipv6 ospf network
- Use to configure the OSPF network type for an interface.
- Specify a network type (broadcast or point-to-point) for the interface.
- Example
host1(config)#interface fastethernet 0/0host1(config-if)#ipv6 ospf network broadcastUse the no version to revert the network type to the default for the interface. ip ospf priority
- Use to configure the router's priority.
- Select a priority level in the range 0255; the default value is 1.
- This setting determines the designated router for the particular network.
- A router whose priority is set to 0 cannot be a designated router.
- Configure priority only for interfaces to multiaccess networks.
- For the IPv6 command, you can specify an optional process ID in the range 165535.
- Example 1
host1(config-if)#ip ospf priority 2Example 2 host1(config-if)#ipv6 ospf priority 2Use the no version to restore the default value, 1. ip ospf retransmit-interval
- Use to configure the time interval between retransmission of an LSA.
- Specify an interval in the range 03600 seconds; the default value is 5 seconds.
- For the IPv6 command, you can specify an optional process ID in the range 165535.
- Example 1
host1(config-if)#ip ospf retransmit-interval 10Example 2 host1(config-if)#ipv6 ospf retransmit-interval 10Use the no version to return to the default value, 5 seconds. ip ospf transmit-delay
- Use to configure the time it takes to transmit a link-state update on the interface.
- This is the time between transmissions of LSAs.
- Specify an interval in the rang 03600 seconds; the default value is 1 second.
- In setting the time, consider the interface's transmission and propagation delays.
- For the IPv6 command, you can specify an optional process ID in the range 165535.
- Example 1
host1(config-if)#ip ospf transmit-delay 4Example 2 host1(config-if)#ipv6 ospf transmit-delay 4Use the no version to return to the default value, 1 second. Comparison Example
In the following example you configure a range of OSPF interfaces with the network area command.
host1(config)#interface fastEthernet 0/0host1(config-if)#ip address 1.1.1.1 255.255.255.0host1(config-if)#ip address 2.2.2.2 255.255.255.0 secondaryhost1(config-if)#exithost1(config)#router ospf 1host1(config-router)#network 1.1.1.0 0.0.0.255 area 0host1(config-router)#network 2.2.2.0 0.0.0.255 area 0If you want to specify the cost, you can do so for both interfaces simultaneously.
host1(config)#interface fastEthernet 0/0host1(config-if)#ip ospf cost 30You can use address commands to create a third OSPF interface over the Ethernet interface. When you specify a cost, you set it for only that interface.
host1(config)#interface fastEthernet 0/0host1(config-if)#ip address 3.3.3.3 255.255.255.0 secondaryhost1(config-if)#exithost1(config)#router ospf 1host1(config-router)#address 3.3.3.3 area 0host1(config-router)#address 3.3.3.3 cost 25Precedence of Commands
For a single OSPF interface, when you modify the same OSPF attribute by issuing both the ip ospf command and the address command, the value configured with the address command takes precedence. In other words, the most specific command for a single OSPF interface takes precedence.
Consider the following example. Suppose you have a numbered IP interface with an IP address of 10.10.1.1/24 sitting on top of Fast Ethernet interface 0/0. Configure a single OSPF interface on top of the IP interface.
host1(config)#router ospf 100host1(router-config)#address 10.10.1.1 area 0The default cost for this OSPF interface is 10. Change the cost for this OSPF interface by using the address cost command.
host1(router-config)#address 10.10.1.1 cost 45The cost for OSPF interface 10.10.1.1 is now 45.
Now use the ip ospf cost command to change the cost for this OSPF interface.
host1(config)#int fastEthernet 0/0host1(config-if)#ip ospf cost 23The cost of OSPF interface 10.10.1.1 does not change. The previously issued address cost command is more specific for the interface and takes precedence over the ip ospf cost command. You must use the address cost command if you want to change the cost again.
host1(router-config)#address 10.10.1.1 cost 23