Disabling OSPF on Certain Interfaces

Problem

You want to prevent the some of a router’s interfaces from taking part in OSPF.

Solution

The passive-interface configuration command effectively disables OSPF on an interface by preventing it from forming OSPF adjacencies:

Router3#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router3(config)#router ospf 44
Router3(config-router)#network 0.0.0.0 255.255.255.255 area 100
Router3(config-router)#passive-interface Ethernet0
Router3(config-router)#exit
Router3(config)#end
Router3#

A useful variant of this command allows you to make all interfaces passive by default until you explicitly enable them:

Router3#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router3(config)#router ospf 44
Router3(config-router)#network 0.0.0.0 255.255.255.255 area 100
Router3(config-router)#passive-interface default
Router3(config-router)#no passive-interface Ethernet0
Router3(config-router)#exit
Router3(config)#end
Router3#

Discussion

OSPF will not start to exchange any routing information until two routers on a segment have formed an adjacency and agreed on the various area parameters, including any authentication requirements. So simply preventing one router from taking part in this handshake is sufficient to prevent the exchange of OSPF information on the interface. Also, while you can use a passive-interface command as shown in the example, you can also prevent an interface from taking part in OSPF ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.