[Contents] [Prev] [Next] [Index] [Report an Error]


Configuring OSPF Interfaces

You can configure OSPF attributes for either a single OSPF network using the address commands, or for all OSPF networks on a particular media interface using the ip ospf commands.

OSPF MTU size 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.

Perform the following tasks to configure OSPF attributes for the OSPF network(s):



Note: Before using the address or ip ospf commands, see Precedence of Commands on p 8-18 for information on 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.



Note: You must first issue the address area command before issuing any other address command.



Note: 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 context—for example, in a multinet environment where multiple IP networks sit on top of an Ethernet interface.

    address area

host1(config-router)#address 10.12.10.2 area 3

    address cost

host1(config-router)#address unnumbered area 3
host1(config-router)#address unnumbered atm 4/0.1 cost 50

    address dead-interval

host1(config-router)#address 192.168.10.32 area 6
host1(config-router)#address 192.168.10.32 dead-interval 60 

    address hello-interval

host1(config-router)#address 192.168.1.1 area 5
host1(config-router)#address 192.168.1.1 hello-interval 25

    address passive-interface

host1(config-router)#address 192.168.100.20 area 5
host1(config-router)#address 192.168.100.20 
passive-interface 

    address priority

host1(config-router)#address unnumbered area 6
host1(config-router)#address unnumbered loopback 0 priority 

    address retransmit-interval

host1(config-router)#address 192.168.10.200 area 6
host1(config-router)#address 192.168.10.200 
retransmit-interval 

    address transmit-delay

host1(config-router)#address 10.100.25.38 area 7
host1(config-router)#address 10.100.25.38 transmit-delay 

ip 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 parameter(s) for all networks configured on the given IP interface—for example, all multinetted addresses on an interface.

The no version of the command resets the specified parameter(s) to unspecified.

If the no version of the command takes effect, then for the specified IP interface there is no default value for the specified parameter(s). 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 parameter(s) for each OSPF interface which sits on top of the IP interface.

The no version of the command restores the specified parameter(s) to the default value(s).



Note: If you use ip ospf commands to configure OSPF interfaces, you must first have created the interfaces with the network area command.



Note: The ip ospf commands configure OSPF attributes for all OSPF networks in the given interface context—for example, in a multinet environment where multiple IP networks sit on top of an Ethernet interface. The address commands configure OSPF attributes for a single OSPF interface.

    ip ospf cost

host1(config)#interface fastethernet 0/0
host1(config-if)#ip ospf cost 50

    ip ospf dead-interval

host1(config-if)#ip ospf dead-interval 60

    ip ospf hello-interval

host1(config-if)#ip ospf hello-interval 8

    ip ospf priority

host1(config-if)#ip ospf priority 2

    ip ospf retransmit-interval

host1(config-if)#ip ospf retransmit-interval 10

    ip ospf transmit-delay

host1(config-if)#ip ospf transmit-delay 4

Comparison Example

Suppose you configure a range of OSPF interfaces with the network area command as follows:

host1(config)#interface fastEthernet 0/0
host1(config-if)#ip address 1.1.1.1 255.255.255.0
host1(config-if)#ip address 2.2.2.2 255.255.255.0 secondary
host1(config-if)#exit
host1(config)#router ospf 1
host1(config-router)#network 1.1.1.0 0.0.0.255 area 0
host1(config-router)#network 2.2.2.0 0.0.0.255 area 0

If you want to specify the cost, you can do so for both interfaces simultaneously:

host1(config)#interface fastEthernet 0/0
host1(config-if)#ip ospf cost 30

You can use address commands to create a third OSPF interface over the Ethernet interface. When you specify a cost, it is set for only that interface:

host1(config)#interface fastEthernet 0/0
host1(config-if)#ip address 3.3.3.3 255.255.255.0 secondary
host1(config-if)#exit
host1(config)#router ospf 1
host1(config-router)#address 3.3.3.3 area 0
host1(config-router)#address 3.3.3.3 cost 25

Precedence 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 100
host1(router-config)#address 10.10.1.1 area 0

The default cost for this OSPF interface is 10. Change the cost for this OSPF interface using the address cost command:

host1(router-config)#address 10.10.1.1 cost 45

The 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/0
host1(config-if)#ip ospf cost 23

The 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

[Contents] [Prev] [Next] [Index] [Report an Error]