Cisco OSPF Router Configuration

To enable #Open Shortest Path First (OSPF) to a #Cisco router, run the command router ospf {process-id} to enter Router Configuration Mode with the process ID ranging from 1 to 65,535. A Router# can run multiple OSPF interfaces (differ by the process ID) at the same time.

By default, the router configured with OSPF will have an OSPF router ID with the highest IP address on an active interface. However, it is advised to manually configure the router ID using the command router-id {ip-address} as manually configured router ID has the highest precedence over any methods that configure a router ID. We can also create a router ID by assigning an IP Address# with subnet mask 255.255.255.255 to the loopback 0 interface.

Note: Although we are assigning an IP Address as a router ID, it will not play a role in actual IP communication. It is only used in OSPF.

To enable an interface to send and receive OSPF packets, we need to specify it with the command network {network-address} {wildcard-mask} area {area-id} where the wildcard mask is derived from the subtraction of the subnet mask 255.255.255.255 with the interface’s network subnet mask#. The area ID specifies a group of OSPF routers that can share link-state information. It is the mechanism to prevent flooding from affecting other networks or Autonomous System (AS). Instead of specifying the network address, we could specify the interface’s exact IP address. In this way, we can just pass in the subnet mask quad zero or 0.0.0.0 instead of calculating the wildcard mask without worrying about it. We can go even further by execute the command ip ospf {process-id} area {area-id} inside each interface of the router without typing out any explicit addresses.

Note: To include a static route# in OSPF update, we can run the command default-information originate in the Router Configuration mode.

If there are multiple OSPF areas within a network, the command area {area-id} range {network-id} {subnet-mask} becomes handy in implementing summarisation of the networks in those areas.

Defining a passive interface to a LAN connection is necessary as to save up bandwidth and resources, and reduce security risk on an OSPF-enabled router from sending OSPF packets. This can be done in Router Configuration running the command passive-interface {interface-name}.

The default OSPF cost in Cisco routers is using a reference bandwidth, usually \(10^8\) over the default bandwidth of the interface. However, with the default value of the reference bandwidth, the cost of travelling in 10 Gigabit Ethernet#, Gigabit Ethernet and Fast Ethernet will be the same which is not true. We can change it with the command auto-cost reference-bandwidth {integer} where the integer is in Mb/s. ip ospf cost {integer} can be used to manually adjust the cost of an interface in the Interface Configuration.

Enabling MD5 authentication in an interface could be done with the command ip ospf message-digest-key {key-id} md5 {password} first create a key and then activate it with ip ospf authentication message-digest.

We can reload the OSPF process by using the command clear ip ospf process in Global Configuration Mode. It is recommended to run it every time when there is a change to the OSPF settings.

For debugging, we could use the command show ip protocols, show ip ospf neighbor, show ip route, show ip ospf interface {interface-name} or show ip ospf.

#networking