What does ‘passive interface’ command does in OSPF ? How to configure it?

In router you can choose to manually set the ‘passive-interface’ command on the interfaces where adjacency is not desired. The interface address that you specify as passive appears as a stub network in the OSPF domain. OSPF routing information is neither sent nor received through the specified device interface.

Passive interface can be configured in two ways

a) By making all interface passive and only allowing one interface to form the adjacy by giving command ‘no passive-interface ‘

RouterA# configure terminal
RouterA# router ospf 10
RouterA#passive-interface default
RouterA#no passive-interface gigabitethernet 0/0/0

b) By enabling the passive interface on specific interface

RouterA# configure terminal
RouterA# router ospf 10
RouterA#passive-interface gigabitethernet 0/0/0