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 by 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