OSPF Configuration, Loopbacks, Passive Interfaces, and Default Route Advertisement

Overview

This lab focuses on setting up and verifying OSPF (Open Shortest Path First) routing in a four-router topology using Cisco IOS commands. The exercise includes configuring loopback interfaces on all routers, enabling OSPF with different methods (wildcard masks, /32 specific matching, and summarized networks), and implementing passive interfaces to suppress unnecessary OSPF hello messages. The lab culminates in configuring R1 as an Autonomous System Boundary Router (ASBR) that advertises a default route into the OSPF domain. Additionally, show commands like show ip ospf neighbor, show ip ospf interface, and show ip route were used to verify adjacencies and route propagation.

Skills Demonstrated
Creating and configuring loopback interfaces
Configuring OSPF using multiple approaches
Setting OSPF passive interfaces for non-routing interfaces
Advertising a default route using default-information originate
Understanding OSPF router ID selection
Using OSPF show commands to analyze protocol behavior
Verifying full OSPF neighbor adjacency and LSDB contents
Observing route propagation and load balancing via OSPF metrics
Tools Used
Cisco Packet Tracer
Route CLI
OSPF Show Commands
Ping Utility

1. Network Topology

I have set up a network topology consisting of four routers connected with crossover cables in OSPF area 0.

R1 is connected to an ISP Router and R4 is connected to a switch and a client PC.


2. Configuring OSPF, Loopback, and Passive Interfaces

OSPF is a link-state dynamic routing protocol. It uses a router's Router ID (RID) to uniquely identify it in the OSPF domain. When a router starts OSPF, it selects its Router ID in the following order:

  1. Manually configured Router ID using the router-id command
router ospf 1
 router-id 1.1.1.1
  1. Highest IP address on any active loopback interface
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
  1. Highest IP address on any active loopback interface (used only if no loopbacks exist and no router-id exists)

Because of this, in this lab, I will be setting the loopback interface on each router.

In terms of passive interfaces, they advertise the subnet, prevent OSPF Hello packets from being set out that interface, and stop neighbor formation on that interface. I will be enabling passive interfaces on the interfaces that are not connected to OSPF routers.

Now, I will configure OSPF, loopback, and passive interfaces on each router.

R1

First, I'll start on R1 by configuring the IP addresses, loopback interface, OSPF, and passive interface:

R1> en
R1# conf t
R1(config)# int f1/0
R1(config-if)# ip address 10.0.13.1 255.255.255.252
R1(config-if)# no shutdown
R1(config-if)# int g0/0
R1(config-if)# ip address 10.0.12.1 255.255.255.252
R1(config-if)# no shutdown
R1(config-if)# int l0
R1(config-if)# ip address 1.1.1.1 255.255.255.255
R1(config-if)# exit
R1(config)# router ospf 1
R1(config-router)# network 10.0.13.1 0.0.0.0 area 0
R1(config-router)# network 10.0.12.1 0.0.0.0 area 0
R1(config-router)# network 1.1.1.1 0.0.0.0 area 0
R1(config-router)# passive-interface l0
R1(config-router)# passive-interface g3/0

R2

Now I will configure the same on R2:

R2> en
R2# conf t
R2(config)# int f1/0
R2(config-if)# ip address 10.0.24.1 255.255.255.252
R2(config-if)# no shutdown
R2(config-if)# int g0/0
R2(config-if)# ip address 10.0.12.2 255.255.255.252
R2(config-if)# no shutdown
R2(config-if)# int l0
R2(config-if)# ip address 2.2.2.2 255.255.255.255
R2(config-if)# exit
R2(config)# router ospf 1
R2(config-router)# network 10.0.12.2 0.0.0.0 area 0
R2(config-router)# network 10.0.24.1 0.0.0.0 area 0
R2(config-router)# network 2.2.2.2 0.0.0.0 area 0
R2(config-router)# passive-interface l0

Running show ip route on R2 we can see the OSPF connection from R1 showing:

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 10.0.12.1, 00:04:05, GigabitEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
     10.0.0.0/30 is subnetted, 1 subnets
C       10.0.12.0 is directly connected, GigabitEthernet0/0

R3

Now I will configure the same on R3:

R3> en
R3# conf t
R3(config)# int f1/0
R3(config-if)# ip address 10.0.13.2 255.255.255.252
R3(config-if)# no shutdown
R3(config-if)# int f2/0
R3(config-if)# ip address 10.0.34.1 255.255.255.252
R3(config-if)# no shutdown
R3(config-if)# int l0
R3(config-if)# ip address 3.3.3.3 255.255.255.255
R3(config-if)# exit
R3(config)# router ospf 1
R3(config-router)# network 10.0.13.2 0.0.0.0 area 0
R3(config-router)# network 10.0.34.1 0.0.0.0 area 0
R3(config-router)# network 3.3.3.3 0.0.0.0 area 0
R3(config-router)# passive-interface l0

Running show ip route on R3 we can see the OSPF connection from R1 and R2 showing:

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 10.0.13.1, 00:00:19, FastEthernet1/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/3] via 10.0.13.1, 00:00:19, FastEthernet1/0
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     10.0.0.0/30 is subnetted, 2 subnets
O       10.0.12.0 [110/2] via 10.0.13.1, 00:00:19, FastEthernet1/0
C       10.0.13.0 is directly connected, FastEthernet1/0

R4

Now I will configure the same on R4:

R4> en
R4# conf t
R4(config)# int f1/0
R4(config-if)# ip address 10.0.24.2 255.255.255.252
R4(config-if)# no shutdown
R4(config-if)# int f2/0
R4(config-if)# ip address 10.0.34.2 255.255.255.252
R4(config-if)# no shutdown
R4(config-if)# int l0
R4(config-if)# ip address 4.4.4.4 255.255.255.255
R4(config-if)# exit
R4(config)# router ospf 1
R4(config-router)# network 10.0.24.2 0.0.0.0 area 0
R4(config-router)# network 10.0.34.2 0.0.0.0 area 0
R4(config-router)# network 192.168.4.254 0.0.0.0 area 0
R4(config-router)# network 4.4.4.4 0.0.0.0 area 0
R4(config-router)# passive-interface l0
R4(config-router)# passive-interface g0/0

Running show ip route on R4 we can see the OSPF connection from R1, R2, and R3 showing:

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/3] via 10.0.34.1, 00:05:10, FastEthernet2/0
                [110/3] via 10.0.24.1, 00:05:10, FastEthernet1/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 10.0.24.1, 00:05:10, FastEthernet1/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 10.0.34.1, 00:05:20, FastEthernet2/0
     4.0.0.0/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback0
     10.0.0.0/30 is subnetted, 4 subnets
O       10.0.12.0 [110/2] via 10.0.24.1, 00:05:10, FastEthernet1/0
O       10.0.13.0 [110/2] via 10.0.34.1, 00:05:20, FastEthernet2/0
C       10.0.24.0 is directly connected, FastEthernet1/0
C       10.0.34.0 is directly connected, FastEthernet2/0

3. Configuring Default Route

Now I will set the default route on R1 for it's g3/0 interface and advertise it to the rest of the routers in the OSPF domain using default-information originate

R1> en
R1# conf t
R1(config)# int g3/0
R1(config-if)# ip address 203.0.113.1 255.255.255.252
R1(config-if)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
R1(config-if)# exit
R1(config)# router ospf 1
R1(config-router)# default-information originate

Now when running the show ip protocols command on R1 we see that it is now the ASBR (Autonomous System Boundary Router):

Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 1.1.1.1
  It is an autonomous system boundary router
  Redistributing External Routes from,
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    10.0.13.1 0.0.0.0 area 0
    10.0.12.1 0.0.0.0 area 0
    1.1.1.1 0.0.0.0 area 0
  Passive Interface(s):
    GigabitEthernet3/0
    Loopback0
  Routing Information Sources:
    Gateway         Distance      Last Update
    1.1.1.1              110      00:14:25
    2.2.2.2              110      00:06:03
    3.3.3.3              110      00:06:09
    4.4.4.4              110      00:05:31
  Distance: (default is 110)

And when running show ip route on R4 (as well as R2 and R3), we can see that it has a default route because of this:

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is 10.0.34.1 to network 0.0.0.0

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/3] via 10.0.34.1, 00:37:23, FastEthernet2/0
                [110/3] via 10.0.24.1, 00:37:23, FastEthernet1/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 10.0.24.1, 00:37:23, FastEthernet1/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 10.0.34.1, 00:37:33, FastEthernet2/0
     4.0.0.0/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback0
     10.0.0.0/30 is subnetted, 4 subnets
O       10.0.12.0 [110/2] via 10.0.24.1, 00:37:23, FastEthernet1/0
O       10.0.13.0 [110/2] via 10.0.34.1, 00:37:33, FastEthernet2/0
C       10.0.24.0 is directly connected, FastEthernet1/0
C       10.0.34.0 is directly connected, FastEthernet2/0
C    192.168.4.0/24 is directly connected, GigabitEthernet0/0
O*E2 0.0.0.0/0 [110/1] via 10.0.34.1, 00:15:41, FastEthernet2/0
               [110/1] via 10.0.24.1, 00:15:41, FastEthernet1/0