Start by entering OSPF configuration mode for a specified OSPF process.

conf t
router ospf 1

Configure the OSPF router ID (RID).

The RID is not required to be manually entered because the router will choose one by default if none is specified.

If none is specified, the RID defaults to the highest numeric loopback with status code:up.

If no loopbacks are configured, it defaults to the highest numeric IP address configured on an interface with status code:up.

It’s considered best practice to specify the RID manually either via the router-id command, or with a loopback address.



interface Loopback1
ip address

Add specified interfaces to OSPF areas.

network area 0

Command Description
network initiate network command mode find all interface IP addresses that matches this VLAN match all addresses defined by this wildcard (0=match exact | 255=ignore).
area 0 defines the area to add all matched interfaces to

If there are no neighbors connected to the interface, place them in passive mode.

This will disable any interfaces connected to any non-OSPF neighbors from sending or receiving Hello packets to save some CPU cycles. Neighbor relationships are not formed over those interfaces.

OSPF Passive mode is generally reserved for interfaces not directly connected to another router.

If most of the interfaces are connected to OSPF neighbors, run this on non-router interfaces.

router ospf 1
passive-interface gigabitEthernet0/0.1
passive-interface gigabitEthernet0/0.2

If most of the interfaces are not connected to OSPF neighbors, it’s easier to places all interfaces by default in passive mode, then specify non-passive interfaces separately. This makes for less CLI work to be done.

passive-interface default
no passive-interface serial0/0/0
no passive-interface serial0/0/1

If you need an OSPF default route, advertise a default route via a specified OSPF interface.

router ospf 1
default-information originate [Always]

The Always subcommand tells the router to always advertise the default route even if the route is not working.