In this lab, you will learn how to set up OSPF version 2 on a network consisting of four routers. You will enable OSPFv2 on router interfaces, assign router IDs, change OSPF network types and costs, block OSPF hellos, and adjust some OSPF default settings. Before you we continue, I’d like to let you know I already wrote a comprehensive guide about OSPF for CCNA.

Table of Contents

Network Diagram

Task 1: Configure router hostnames and IP addresses according to the following table

Device Interface IP Address/Subnet Mask
R1 loopback 0 10.0.1.1/24
Gigabitethernet 0/0 10.0.0.1/24
Gigabitethernet 0/2 10.0.12.1/24
R2 loopback 0 10.0.2.2/24
loopback 1 10.0.20.2/24
Gigabitethernet 0/0 10.0.0.2/24
Gigabitethernet 0/1 10.0.12.2/24
R3 loopback 0 10.0.3.3/24
loopback 1 10.0.30.3/24
loopback 2 10.0.31.3/24
Gigabitethernet 0/0 10.0.0.3/24
Gigabitethernet 0/2 10.0.34.3/24
R4 loopback 0 10.0.4.4/24
loopback 1 10.0.40.4/24
loopback 2 10.0.41.4/24
loopback 3 10.0.42.4/24
Gigabitethernet 0/0 10.0.0.4/24
Gigabitethernet 0/3 10.0.34.4/24

Router R1

Router(config)# hostname R1
R1(config)# interface loopback 0
R1(config-if)# ip address 10.0.1.1 255.255.255.0
R1(config-if)# 
R1(config-if)# interface gigabitethernet 0/0
R1(config-if)# ip address 10.0.0.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# 
R1(config-if)# 
R1(config-if)# interface gigabitethernet 0/2
R1(config-if)# ip address 10.0.12.1 255.255.255.0
R1(config-if)# no shutdown

Router R2

Router(config)# hostname R2
R2(config)# interface loopback 0
R2(config-if)# ip address 10.0.2.2 255.255.255.0
R2(config-if)# 
R2(config-if)# interface loopback 1
R2(config-if)# ip address 10.0.20.2 255.255.255.0
R2(config-if)# 
R2(config-if)# interface gigabitethernet 0/0
R2(config-if)# ip address 10.0.0.2 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# 
R2(config-if)# 
R2(config-if)# interface gigabitethernet 0/1
R2(config-if)# ip address 10.0.12.2 255.255.255.0
R2(config-if)# no shutdown

Router R3

Router(config)# hostname R3
R3(config)# interface loopback 0
R3(config-if)# ip address 10.0.3.3 255.255.255.0
R3(config-if)# 
R3(config-if)# interface loopback 1
R3(config-if)# ip address 10.0.30.3 255.255.255.0
R3(config-if)# 
R3(config-if)# interface loopback 2
R3(config-if)# ip address 10.0.31.3 255.255.255.0
R3(config-if)# 
R3(config-if)# 
R3(config-if)# 
R3(config-if)# interface gigabitethernet 0/0
R3(config-if)# ip address 10.0.0.3 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# 
R3(config-if)# interface gigabitethernet 0/2
R3(config-if)# ip address 10.0.34.3 255.255.255.0
R3(config-if)# no shutdown

Router R4

Router(config)# hostname R4
R4(config)# interface loopback 0
R4(config-if)# ip address 10.0.4.4 255.255.255.0
R4(config-if)# 
R4(config-if)# interface loopback 1
R4(config-if)# ip address 10.0.40.4 255.255.255.0
R4(config-if)# 
R4(config-if)# interface loopback 2
R4(config-if)# ip address 10.0.41.4 255.255.255.0
R4(config-if)# 
R4(config-if)# interface loopback 3
R4(config-if)# ip address 10.0.42.4 255.255.255.0
R4(config-if)# 
R4(config-if)# interface gigabitethernet 0/0
R4(config-if)# ip address 10.0.0.4 255.255.255.0
R4(config-if)# no shutdown
R4(config-if)# 
R4(config-if)# interface gigabitethernet 0/3
R4(config-if)# ip address 10.0.34.4 255.255.255.0
R4(config-if)# no shutdown

At this point in the lab, we need to check that each router can ping its neighbors. It is enough to ping routers R2, R3, and R4 from router R1, and ping router R4 from R3  to achieve that.

Router R3

R1# ping 10.0.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.12.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 3/4/5 ms
R1#  ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 3/4/6 ms
R1# ping 10.0.0.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/5/9 ms
R1# ping 10.0.0.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.4, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/4/5 ms

Router R3

R3# ping 10.0.0.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.4, timeout is 2 seconds:
.!!!!

Task 2: Enable OSPFv2 on all routers, and place all interfaces into area 0

Router R1

R1(config)# router ospf 1
R1(config-router)# network 10.0.1.1 0.0.0.0 area 0
R1(config-router)# network 10.0.0.1 0.0.0.0 area 0
R1(config-router)# network 10.0.12.1 0.0.0.0 area 0

Router R2

R2(config)# interface loopback 0
R2(config-if)# ip ospf 1 area 0
R2(config-if)# interface loopback 1
R2(config-if)# ip ospf 1 area 0
R2(config-if)# interface gigabitethernet 0/0
R2(config-if)# ip ospf 1 area 0
R2(config-if)# interface gigabitethernet 0/1
R2(config-if)# ip ospf 1 area 0

Router R3

R3(config)# router ospf 1
R3(config-router)# network 10.0.0.0 0.0.255.255 area 0

Router R4

R4(config)# router ospf 1
R4(config-router)# network 0.0.0.0 255.255.255.255 area 0

Task 3: Check that each router built up neighbor relationships with its adjacent nodes

As shown in the show ip ospf neighbor outputs below, each router is forming four neighbor relationships. R1 and R2 built up three full neighborships each. They don’t build up an OSPF neighbor relationship in subnet 10.0.0.0/24 with each other because they are both DROther routers. On multiaccess data-links, where DR/BDR election occurs, DROther (non-DR/BDR) nodes do not form full OSPF neighbor relationships between them.

On the other hand, routers R3 and R4 built up OSPF adjacencies with every neighbor because they are either DR or BDR on their connected physical subnets.

Router R1

R1# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
10.0.20.2         1   FULL/DR         00:00:36    10.0.12.2       GigabitEthernet0/2
10.0.20.2         1   2WAY/DROTHER    00:00:34    10.0.0.2        GigabitEthernet0/0
10.0.31.3         1   FULL/BDR        00:00:37    10.0.0.3        GigabitEthernet0/0
10.0.42.4         1   FULL/DR         00:00:36    10.0.0.4        GigabitEthernet0/0

Router R2

R2# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
10.0.1.1          1   FULL/BDR        00:00:33    10.0.12.1       GigabitEthernet0/1
10.0.1.1          1   2WAY/DROTHER    00:00:36    10.0.0.1        GigabitEthernet0/0
10.0.31.3         1   FULL/BDR        00:00:32    10.0.0.3        GigabitEthernet0/0
10.0.42.4         1   FULL/DR         00:00:32    10.0.0.4        GigabitEthernet0/0

Router R3

R3# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
10.0.42.4         1   FULL/DR         00:00:30    10.0.34.4       GigabitEthernet0/2
10.0.1.1          1   FULL/DROTHER    00:00:35    10.0.0.1        GigabitEthernet0/0
10.0.20.2         1   FULL/DROTHER    00:00:32    10.0.0.2        GigabitEthernet0/0
10.0.42.4         1   FULL/DR         00:00:31    10.0.0.4        GigabitEthernet0/0

Router R4

R4# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
10.0.31.3         1   FULL/BDR        00:00:31    10.0.34.3       GigabitEthernet0/3
10.0.1.1          1   FULL/DROTHER    00:00:31    10.0.0.1        GigabitEthernet0/0
10.0.20.2         1   FULL/DROTHER    00:00:38    10.0.0.2        GigabitEthernet0/0
10.0.31.3         1   FULL/BDR        00:00:37    10.0.0.3        GigabitEthernet0/0

Task 4: Check that each router learned all routes advertised by the other OSPF nodes

The number of routes that each router should learn equals the total number of subnets advertised by all routers in the OSPF (13 subnets) minus the number of OSPF-enabled interfaces on the router.

The table below contains the number of routes that must be learned by each router, while the show ip route ospf outputs display those routes.

Router Number of OSPF-Enabled Interfaces Number of OSPF Routes That Should Be Learned
R1 3 10
R2 4 9
R3 5 8
R4 6 7

 

Router R1

R1# show ip route ospf
Codes: L - local, C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 16 subnets, 2 masks
O        10.0.2.2/32 [110/2] via 10.0.12.2, 00:00:27, GigabitEthernet0/2
[110/2] via 10.0.0.2, 00:00:27, GigabitEthernet0/0
O        10.0.3.3/32 [110/2] via 10.0.0.3, 00:00:27, GigabitEthernet0/0
O        10.0.4.4/32 [110/2] via 10.0.0.4, 00:00:27, GigabitEthernet0/0
O        10.0.20.2/32 [110/2] via 10.0.12.2, 00:00:27, GigabitEthernet0/2
[110/2] via 10.0.0.2, 00:00:27, GigabitEthernet0/0
O        10.0.30.3/32 [110/2] via 10.0.0.3, 00:00:27, GigabitEthernet0/0
O        10.0.31.3/32 [110/2] via 10.0.0.3, 00:00:27, GigabitEthernet0/0
O        10.0.34.0/24 [110/2] via 10.0.0.4, 00:00:27, GigabitEthernet0/0
[110/2] via 10.0.0.3, 00:00:27, GigabitEthernet0/0
O        10.0.40.4/32 [110/2] via 10.0.0.4, 00:00:27, GigabitEthernet0/0
O        10.0.41.4/32 [110/2] via 10.0.0.4, 00:00:27, GigabitEthernet0/0
O        10.0.42.4/32 [110/2] via 10.0.0.4, 00:00:27, GigabitEthernet0/0

Router R2

R2# show ip route ospf
Codes: L - local, C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 17 subnets, 2 masks
O        10.0.1.1/32 [110/2] via 10.0.12.1, 00:11:32, GigabitEthernet0/1
[110/2] via 10.0.0.1, 00:11:32, GigabitEthernet0/0
O        10.0.3.3/32 [110/2] via 10.0.0.3, 00:11:32, GigabitEthernet0/0
O        10.0.4.4/32 [110/2] via 10.0.0.4, 00:11:32, GigabitEthernet0/0
O        10.0.30.3/32 [110/2] via 10.0.0.3, 00:11:32, GigabitEthernet0/0
O        10.0.31.3/32 [110/2] via 10.0.0.3, 00:11:32, GigabitEthernet0/0
O        10.0.34.0/24 [110/2] via 10.0.0.4, 00:11:32, GigabitEthernet0/0
[110/2] via 10.0.0.3, 00:11:32, GigabitEthernet0/0
O        10.0.40.4/32 [110/2] via 10.0.0.4, 00:11:32, GigabitEthernet0/0
O        10.0.41.4/32 [110/2] via 10.0.0.4, 00:11:32, GigabitEthernet0/0
O        10.0.42.4/32 [110/2] via 10.0.0.4, 00:11:32, GigabitEthernet0/0

Router R3

R3# show ip route ospf
Codes: L - local, C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 18 subnets, 2 masks
O        10.0.1.1/32 [110/2] via 10.0.0.1, 00:12:45, GigabitEthernet0/0
O        10.0.2.2/32 [110/2] via 10.0.0.2, 00:12:45, GigabitEthernet0/0
O        10.0.4.4/32 [110/2] via 10.0.34.4, 00:12:45, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:12:45, GigabitEthernet0/0
O        10.0.12.0/24 [110/2] via 10.0.0.2, 00:11:53, GigabitEthernet0/0
[110/2] via 10.0.0.1, 00:11:53, GigabitEthernet0/0
O        10.0.20.2/32 [110/2] via 10.0.0.2, 00:12:45, GigabitEthernet0/0
O        10.0.40.4/32 [110/2] via 10.0.34.4, 00:12:45, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:12:45, GigabitEthernet0/0
O        10.0.41.4/32 [110/2] via 10.0.34.4, 00:12:45, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:12:45, GigabitEthernet0/0
O        10.0.42.4/32 [110/2] via 10.0.34.4, 00:12:45, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:12:45, GigabitEthernet0/0

Router R4

R4# show ip route ospf
Codes: L - local, C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 19 subnets, 2 masks
O        10.0.1.1/32 [110/2] via 10.0.0.1, 00:15:13, GigabitEthernet0/0
O        10.0.2.2/32 [110/2] via 10.0.0.2, 00:15:13, GigabitEthernet0/0
O        10.0.3.3/32 [110/2] via 10.0.34.3, 00:15:53, GigabitEthernet0/3
[110/2] via 10.0.0.3, 00:15:13, GigabitEthernet0/0
O        10.0.12.0/24 [110/2] via 10.0.0.2, 00:12:27, GigabitEthernet0/0
[110/2] via 10.0.0.1, 00:12:27, GigabitEthernet0/0
O        10.0.20.2/32 [110/2] via 10.0.0.2, 00:15:13, GigabitEthernet0/0
O        10.0.30.3/32 [110/2] via 10.0.34.3, 00:15:53, GigabitEthernet0/3
[110/2] via 10.0.0.3, 00:15:13, GigabitEthernet0/0
O        10.0.31.3/32 [110/2] via 10.0.34.3, 00:15:53, GigabitEthernet0/3
[110/2] via 10.0.0.3, 00:15:13, GigabitEthernet0/0

Task 5: Modify OSPF router IDs based on the following table, and ensure the changes take effect

Router Router ID
R1 1.1.1.1
R2 2.2.2.2
R3 3.3.3.3
R4 4.4.4.4

 

Router R1

R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)#  end
R1# clear ip ospf process
Reset ALL OSPF processes? [no]: y
R1#

Router R2

R2(config)# router ospf 1
R2(config-router)# router-id 2.2.2.2
R2(config-router)#  end
R2# clear ip ospf process
Reset ALL OSPF processes? [no]: y
R2#

Router R3

R3(config)# router ospf 1
R3(config-router)# router-id 3.3.3.3
R3(config-router)#  end
R3# clear ip ospf process
Reset ALL OSPF processes? [no]: y
R3#

Router R4

R4(config)# router ospf 1
R4(config-router)# router-id 4.4.4.4
R4(config-router)#  end
R4# clear ip ospf process
Reset ALL OSPF processes? [no]: y
R4#

As you can see in the outputs of the show ip ospf command below, OSPF is working using the new router IDs.

Router R1

R1> show ip ospf
Routing Process "ospf 1" with ID 1.1.1.1


omitted output

Router R2

R2> show ip ospf
Routing Process "ospf 1" with ID 2.2.2.2


omitted output

Router R3

R3> show ip ospf
Routing Process "ospf 1" with ID 3.3.3.3



omitted output

Router R4

R4> show ip ospf
Routing Process "ospf 1" with ID 4.4.4.4


omitted output

Task 6: Configure the network so that loopback interfaces get advertised into OSPF with their real subnet masks

By default, OSPF advertises loopback interfaces with the /32 subnet mask. To instruct OSPF the advertise the real subnet mask, set the network type to point-to-point, which is the only available value to assign to loopback interfaces. If you try to set the OSPF network type of a loopback interface to broadcast, non-broadcast, or point-to-multipoint, Cisco IOS rejects your action and shows an error message similar to the one below.

% OSPF: Invalid type for interface Loopback0

Router R1

R1(config)# interface loopback0
R1(config-if)# ip ospf network point-to-point

Router R2

R2(config)# interface loopback0
R2(config-if)# ip ospf network point-to-point
R2(config-if)# 
R2(config-if)# interface loopback1
R2(config-if)# ip ospf network point-to-point

Router R3

R3(config)# interface loopback0
R3(config-if)# ip ospf network point-to-point
R3(config-if)# 
R3(config-if)# interface loopback1
R3(config-if)# ip ospf network point-to-point
R3(config-if)# 
R3(config-if)# interface loopback2
R3(config-if)# ip ospf network point-to-point

Router R4

R4(config)# interface loopback0
R4(config-if)# ip ospf network point-to-point
R4(config-if)# 
R4(config-if)# interface loopback1
R4(config-if)# ip ospf network point-to-point
R4(config-if)# 
R4(config-if)# interface loopback2
R4(config-if)# ip ospf network point-to-point
R4(config-if)# 
R4(config-if)# interface loopback3
R4(config-if)# ip ospf network point-to-point

To verify our configuration, it is enough to display OSPF routes on two routers only using the show ip route ospf command.

Router R2

R2# show ip route ospf
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 17 subnets, 2 masks
O        10.0.1.0/24 [110/2] via 10.0.12.1, 00:10:00, GigabitEthernet0/1
[110/2] via 10.0.0.1, 00:10:00, GigabitEthernet0/0
O        10.0.3.0/24 [110/2] via 10.0.0.3, 00:09:13, GigabitEthernet0/0
O        10.0.4.0/24 [110/2] via 10.0.0.4, 00:09:03, GigabitEthernet0/0
O        10.0.30.0/24 [110/2] via 10.0.0.3, 00:09:13, GigabitEthernet0/0
O        10.0.31.0/24 [110/2] via 10.0.0.3, 00:09:13, GigabitEthernet0/0
O        10.0.34.0/24 [110/2] via 10.0.0.4, 00:47:19, GigabitEthernet0/0
[110/2] via 10.0.0.3, 00:47:19, GigabitEthernet0/0
O        10.0.40.0/24 [110/2] via 10.0.0.4, 00:08:51, GigabitEthernet0/0
O        10.0.41.0/24 [110/2] via 10.0.0.4, 00:08:51, GigabitEthernet0/0
O        10.0.42.0/24 [110/2] via 10.0.0.4, 00:08:51, GigabitEthernet0/0

Router R3

Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 18 subnets, 2 masks
O        10.0.1.0/24 [110/2] via 10.0.0.1, 00:10:12, GigabitEthernet0/0
O        10.0.2.0/24 [110/2] via 10.0.0.2, 00:09:44, GigabitEthernet0/0
O        10.0.4.0/24 [110/2] via 10.0.34.4, 00:09:15, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:09:15, GigabitEthernet0/0
O        10.0.12.0/24 [110/2] via 10.0.0.2, 00:47:21, GigabitEthernet0/0
[110/2] via 10.0.0.1, 00:47:21, GigabitEthernet0/0
O        10.0.20.0/24 [110/2] via 10.0.0.2, 00:09:44, GigabitEthernet0/0
O        10.0.40.0/24 [110/2] via 10.0.34.4, 00:09:03, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:09:03, GigabitEthernet0/0
O        10.0.41.0/24 [110/2] via 10.0.34.4, 00:09:03, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:09:03, GigabitEthernet0/0
O        10.0.42.0/24 [110/2] via 10.0.34.4, 00:09:03, GigabitEthernet0/2
[110/2] via 10.0.0.4, 00:09:03, GigabitEthernet0/0

Additionally, we can display Type-1 LSAs on any router using the show ip ospf database router command to check the subnet mask advertised for each loopback interface.

Router R1

R1# show ip ospf database router

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

  LS age: 244
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000014
  Checksum: 0x3C67
  Length: 60
  Number of Links: 3

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.12.2
     (Link Data) Router Interface address: 10.0.12.1
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.4
     (Link Data) Router Interface address: 10.0.0.1
      Number of MTID metrics: 0
       TOS 0 Metrics: 1


  LS age: 212
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 2.2.2.2
  Advertising Router: 2.2.2.2
  LS Seq Number: 8000000F
  Checksum: 0xF875
  Length: 72
  Number of Links: 4

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.2.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.20.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.12.2
     (Link Data) Router Interface address: 10.0.12.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.4
     (Link Data) Router Interface address: 10.0.0.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 1


  LS age: 198
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 8000000E
  Checksum: 0x2FC2
  Length: 84
  Number of Links: 5

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.3.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.30.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.31.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.34.4
     (Link Data) Router Interface address: 10.0.34.3
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.4
     (Link Data) Router Interface address: 10.0.0.3
      Number of MTID metrics: 0
       TOS 0 Metrics: 1


  LS age: 176
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 4.4.4.4
  Advertising Router: 4.4.4.4
  LS Seq Number: 8000000F
  Checksum: 0x9DEE
  Length: 96
  Number of Links: 6

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.4.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.40.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.41.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.42.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.34.4
     (Link Data) Router Interface address: 10.0.34.4
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.4
     (Link Data) Router Interface address: 10.0.0.4
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

Task 7: Check that router R4 can ping IP addresses configured on routers R1, R2, and R3

To test connectivity to all IP addresses in the network:
Step1. Issue the tclsh command in enable mode.

R4# tclsh

Step 2. Type foreach address {, and then hit enter.

R4(tcl)# foreach address {

Step 3. Enter each IP address in a separated line.

+>(tcl)#10.0.1.1
+>(tcl)#10.0.0.1
+>(tcl)#10.0.12.1
+>(tcl)#10.0.2.2
+>(tcl)#10.0.20.2
+>(tcl)#10.0.0.2
+>(tcl)#10.0.12.2
+>(tcl)#10.0.3.3
+>(tcl)#10.0.30.3
+>(tcl)#10.0.31.3
+>(tcl)#10.0.0.3
+>(tcl)#10.0.34.3
+>(tcl)#10.0.4.4
+>(tcl)#10.0.40.4
+>(tcl)#10.0.41.4
+>(tcl)#10.0.42.4
+>(tcl)#10.0.0.4
+>(tcl)#10.0.34.4

Step 4. Type } { ping $address}, and then hit enter.

+>(tcl)# } { ping $address}

Step 5. Exit TCL shell using the tclquit command..

R4(tcl)# tclquit

Once you finish, you will get the following output.

Router R4

R4#  tclsh
R4(tcl)# foreach address {
+>(tcl)# 10.0.1.1
+>(tcl)# 10.0.0.1
+>(tcl)# 10.0.12.1
+>(tcl)# 10.0.2.2
+>(tcl)# 10.0.20.2
+>(tcl)# 10.0.0.2
+>(tcl)# 10.0.12.2
+>(tcl)# 10.0.3.3
+>(tcl)# 10.0.30.3
+>(tcl)# 10.0.31.3
+>(tcl)# 10.0.0.3
+>(tcl)# 10.0.34.3
+>(tcl)# 10.0.4.4
+>(tcl)# 10.0.40.4
+>(tcl)# 10.0.41.4
+>(tcl)# 10.0.42.4
+>(tcl)# 10.0.0.4
+>(tcl)# 10.0.34.4
+>(tcl)#  } { ping $address}
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/7 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/8 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/8 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/5/7 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/10 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/5/9 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.12.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/9 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/8 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.30.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/7 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.31.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/7 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/8 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.34.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/6 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.40.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/3 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.41.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/5 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.42.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/3 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/5 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.34.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/3 ms
R4(tcl)#
R4(tcl)#
R4(tcl)# tclquit 
R4#

As you can notice, router R4 has full IP reachability to all subnets in the network.

Task 8: Configure router R3 to become DR in subnet 10.0.0.0/24

The router with the highest OSPF priority becomes DR upon the election process. Therefore, we set OSPF priority for interface GigabitEthernet 0/0 to 255 so that R3 becomes the node with the highest priority since router interfaces connected to subnet 10.0.0.0/24 have the default priority of 1.

R3(config)# interface gigabitEthernet 0/0
R3(config-if)# ip ospf priority 255

The show ip ospf interface command output below indicates that our configuration took effect. However, router R4 is still DR in subnet 10.0.0.0/24.

R3# show ip ospf interface gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up 
  Internet Address 10.0.0.3/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Transmit Delay is 1 sec, State BDR, Priority 255
  Designated Router (ID) 4.4.4.4, Interface address 10.0.0.4
  Backup Designated router (ID) 3.3.3.3, Interface address 10.0.0.3
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:02
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/1/1, flood queue length 0
  Next 0x0(0)/0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 3
  Last flood scan time is 0 msec, maximum is 1 msec
  Neighbor Count is 3, Adjacent neighbor count is 3 
    Adjacent with neighbor 1.1.1.1
    Adjacent with neighbor 2.2.2.2
    Adjacent with neighbor 4.4.4.4  (Designated Router)
  Suppress hello for 0 neighbor(s)

To force R3 to be elected DR, we restart R4’s OSPF process.

R4# clear ip ospf process
Reset ALL OSPF processes? [no]: y
R4#

Now, router R3 is elected DR on subnet 10.0.0.0/24.

R4# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DR         00:00:32    10.0.34.3       GigabitEthernet0/3
1.1.1.1           1   FULL/DROTHER    00:00:32    10.0.0.1        GigabitEthernet0/0
2.2.2.2           1   FULL/DROTHER    00:00:30    10.0.0.2        GigabitEthernet0/0
3.3.3.3         255   FULL/DR         00:00:34    10.0.0.3        GigabitEthernet0/0

Task 9: Set the OSPF network type in subnets 10.0.12.0/24 and 10.0.34.0/24 to point-to-point

Router R1

R1(config)# interface GigabitEthernet0/2
R1(config-if)# ip ospf network point-to-point

Router R2

R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip ospf network point-to-point

Router R3

R3(config)# interface GigabitEthernet0/2
R3(config-if)# ip ospf network point-to-point

Router R4

R4(config)# interface GigabitEthernet0/3
R4(config-if)# ip ospf network point-to-point

OSPF Routers connected to a particular data link should use the same network type in order to build full OSPF neighbor relationships and share routing information. The show ip ospf interface outputs below indicate that the routers could rebuild OSPf adjacencies in subnets 10.0.12.0/24 and 10.0.034.0/24 after they get lost upon changing interfaces’ network types.

Task 10: What is the reference bandwidth used in the OSPF routing domain?

Router R1

R1# show ip ospf | include Reference
Reference bandwidth unit is 100 mbps

Router R2

R2# show ip ospf | include Reference
Reference bandwidth unit is 100 mbps

Router R3

R3# show ip ospf | include Reference
Reference bandwidth unit is 100 mbps

Router R4

R4# show ip ospf | include Reference
Reference bandwidth unit is 100 mbps

The show ip ospf command indicates that the reference bandwidth used on all routers is 100Mbps, which is the default value.

Task 11: Set the OSPF reference bandwidth to 10Gbps on all routers

Router R1

R1(config)# router ospf 1                         
R1(config-router)# auto-cost reference-bandwidth 10000

Router R2
R2(config)# router ospf 1
R2(config-router)# auto-cost reference-bandwidth 10000

Router R3

R3(config)# router ospf 1
R3(config-router)# auto-cost reference-bandwidth 10000

Router R4

R4(config)# router ospf 1
R4(config-router)# auto-cost reference-bandwidth 10000

OSPF uses the reference bandwidth and the interface’s bandwidth to calculate its OSPF cost. On Cisco IOS, OSPF cost equals the whole number part of the reference bandwidth divided by the interface’s bandwidth. The fractional part of the resulting value is ignored even if it is different from zero.

For example, for reference bandwidth 100Mbps and bandwidth 1544kbps, the OSPF cost is 64, the integer part of 100/1.544 (= 64.77).

Task 12: Calculate the new OSPF cost of R1’s G0/0 interface

The reference bandwidth is 10Gbps, and the bandwidth of R1’s G0/0 interface equals 1Gbps. Therefore, by applying the formula discussed in the previous task, the new OSPF cost of the interface is 10, as seen below.

R1# show ip ospf interface gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up 
  Internet Address 10.0.0.1/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           10        no          no            Base
  Transmit Delay is 1 sec, State DROTHER, Priority 1
  Designated Router (ID) 3.3.3.3, Interface address 10.0.0.3
  Backup Designated router (ID) 4.4.4.4, Interface address 10.0.0.4
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:00
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/2/2, flood queue length 0
  Next 0x0(0)/0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 3
  Last flood scan time is 0 msec, maximum is 2 msec
  Neighbor Count is 3, Adjacent neighbor count is 2 
    Adjacent with neighbor 3.3.3.3  (Designated Router)
    Adjacent with neighbor 4.4.4.4  (Backup Designated Router)
  Suppress hello for 0 neighbor(s)

Task 13: Disable OSPF Hellos on all loopback interfaces

The passive-interface command allows network engineers to stop sending OSPF Hello packets over a specific interface or all router interfaces.

Router R1

R1(config)# router ospf 1
R1(config-router)# passive-interface loopback0

Router R2

R2(config)# router ospf 1
R2(config-router)# passive-interface loopback0
R2(config-router)# passive-interface loopback1

Router R3

R3(config)# router ospf 1
R3(config-router)# passive-interface loopback0
R3(config-router)# passive-interface loopback1
R3(config-router)# passive-interface loopback2

Router R4

R4(config)# router ospf 1
R4(config-router)# passive-interface loopback0
R4(config-router)# passive-interface loopback1
R4(config-router)# passive-interface loopback2
R4(config-router)# passive-interface loopback3

To verify our configuration, we use the show ip protocols command.

Router R1

R1# show ip protocols
*** IP Routing is NSF aware ***

Routing Protocol is "application"
  Sending updates every 0 seconds
  Invalid after 0 seconds, hold down 0, flushed after 0
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Maximum path: 32
  Routing for Networks:
  Routing Information Sources:
    Gateway         Distance      Last Update
  Distance: (default is 4)

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
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    10.0.0.1 0.0.0.0 area 0
    10.0.1.1 0.0.0.0 area 0
    10.0.12.1 0.0.0.0 area 0
  Passive Interface(s):
    Loopback0

omitted output

Router R2

R2# show ip protocols
*** IP Routing is NSF aware ***

Routing Protocol is "application"
  Sending updates every 0 seconds
  Invalid after 0 seconds, hold down 0, flushed after 0
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Maximum path: 32
  Routing for Networks:
  Routing Information Sources:
    Gateway         Distance      Last Update
  Distance: (default is 4)

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 2.2.2.2
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
  Routing on Interfaces Configured Explicitly (Area 0):
    Loopback0
    Loopback1
    GigabitEthernet0/1
    GigabitEthernet0/0
  Passive Interface(s):
    Loopback0
    Loopback1

omitted output

Router R3

R3# show ip protocols
*** IP Routing is NSF aware ***

Routing Protocol is "application"
  Sending updates every 0 seconds
  Invalid after 0 seconds, hold down 0, flushed after 0
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Maximum path: 32
  Routing for Networks:
  Routing Information Sources:
    Gateway         Distance      Last Update
  Distance: (default is 4)

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 3.3.3.3
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    10.0.0.0 0.0.255.255 area 0
  Passive Interface(s):
    Loopback0
    Loopback1
    Loopback2

omitted output

Router R4

R4# show ip protocols
*** IP Routing is NSF aware ***

Routing Protocol is "application"
  Sending updates every 0 seconds
  Invalid after 0 seconds, hold down 0, flushed after 0
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Maximum path: 32
  Routing for Networks:
  Routing Information Sources:
    Gateway         Distance      Last Update
  Distance: (default is 4)

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 4.4.4.4
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    0.0.0.0 255.255.255.255 area 0
  Passive Interface(s):
    Loopback0
    Loopback1
    Loopback2
    Loopback3

omitted output

Task 14: Set the OSPF Hello and Dead intervals to 1 second and 4 seconds on subnet 10.0.34.0/24

Router R3

R3(config)# interface gigabitEthernet 0/2
R3(config-if)# ip ospf hello-interval 1
R3(config-if)# ip ospf dead-interval 4

Router R4

R4(config)# interface gigabitEthernet 0/3
R4(config-if)# ip ospf hello-interval 1
R4(config-if)# ip ospf dead-interval 4

The show ip ospf interface command outputs confirm that our configuration has been applied successfully.
Router R3

R3# show ip ospf interface gigabitEthernet 0/2
GigabitEthernet0/2 is up, line protocol is up 
  Internet Address 10.0.34.3/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 10
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           10        no          no            Base
  Transmit Delay is 1 sec, State POINT_TO_POINT
  Timer intervals configured, Hello 1, Dead 4, Wait 4, Retransmit 5


omitted output

Router R4

R4# show ip ospf interface gigabitEthernet 0/3
GigabitEthernet0/3 is up, line protocol is up 
  Internet Address 10.0.34.4/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 4.4.4.4, Network Type POINT_TO_POINT, Cost: 10
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           10        no          no            Base
  Transmit Delay is 1 sec, State POINT_TO_POINT
  Timer intervals configured, Hello 1, Dead 4, Wait 4, Retransmit 5


omitted output

Task 15: Set the OSPF cost of R4’s G0/0 interface to 100

Router R4

R4(config)# interface gigabitEthernet 0/0
R4(config-if)# ip ospf cost 100

Task 16: What is the new path to IP address 10.0.1.1 from router R4? Calculate its accumulative cost?

Router R4

R4# traceroute 10.0.1.1
Type escape sequence to abort.
Tracing the route to 10.0.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 10.0.34.3 4 msec 4 msec 4 msec
  2 10.0.0.1 8 msec 5 msec *

The traceroute command output shows that router R4’s path to 10.0.1.1 crosses router R3, then R1 before reaching that IP address. The accumulative OSPF cost equals the sum of the costs of R4’s G0/0 (10), R3’s G0/0 (10), and R1’s loopback0 (1) interfaces. Therefore, R4’s path cost to R1’s loopback0 interface is 21, as shown in the show ip route command below.

R4# show ip route 10.0.1.1
Routing entry for 10.0.1.0/24
  Known via "ospf 1", distance 110, metric 21, type intra area
  Last update from 10.0.34.3 on GigabitEthernet0/3, 00:10:10 ago
  Routing Descriptor Blocks:
  * 10.0.34.3, from 1.1.1.1, 00:10:10 ago, via GigabitEthernet0/3
      Route metric is 21, traffic share count is 1

Task 17: Set the OSPF cost of R3’s G0/0 interface to 2 without using the IP ospf cost command

When the ip ospf cost command is not configured, OSPF calculates the interface cost using the formula in task 11. Since we are not allowed to use the ip ospf cost command, we set G0/0’s bandwidth to 5Gbps so that the result of the formula is 2.

Router R3

R3(config)# interface gigabitEthernet 0/0
R3(config-if)# bandwidth 5000000

To verify our configuration, we use the show ip ospf interface command.

R3# show ip ospf interface gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up 
  Internet Address 10.0.0.3/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 2


omitted output

Task 18: Add the following loopback interface on router R3

Interface IP Address/Subnet Mask
Loopback3 10.0.32.3/24
Loopback4 10.0.33.3/24
Loopback5 10.0.35.3/24

 

Router R3

R3(config)# interface loopback 3
R3(config-if)# ip address 10.0.32.3 255.255.255.0
R3(config-if)# 
R3(config-if)# interface loopback 4
R3(config-if)# ip address 10.0.33.3 255.255.255.0
R3(config-if)# 
R3(config-if)# interface loopback 5
R3(config-if)# ip address 10.0.35.3 255.255.255.0

Task 19: Configure router R3 to inject a default route in the OSPF routing domain so that the routers can reach loopback interfaces configured in the previous task

If a router’s routing table includes a default external route learned through a dynamic routing protocol or statically configured, you can use the default-information originate command in router submode to advertise that route into the OSPF domain.

Since router R3 does not have a default route in the routing table, we use the default-information originate always command to inject route 0.0.0.0/0 into the OSPF autonomous system.

Router R3

R3(config)# router ospf 1
R3(config-router)# default-information originate always

OSPF gateway of last resort has been injected successfully into the autonomous system, as you can see in the show ip route command outputs.

Router R1

R1# show ip route
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is 10.0.0.3 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.0.0.3, 00:01:25, GigabitEthernet0/0

omitted output

Router R2

R2# show ip route
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is 10.0.0.3 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.0.0.3, 00:01:40, GigabitEthernet0/0


omitted output

Router R4

R4# show ip route
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is 10.0.34.3 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.0.34.3, 00:02:03, GigabitEthernet0/3



omitted output

Finally, router R3 advertises the default route with metric-type 2 and cost 1 using an LSA Type-5.

Router R3

R3# show ip ospf database external

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Type-5 AS External Link States

  LS age: 323
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 0.0.0.0 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0xE0C5
  Length: 36
  Network Mask: /0
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 1 
        Forward Address: 0.0.0.0
        External Route Tag: 1

Related Lessons to Basic OSPF Configuration Lab for CCNA

Conclusion

I hope this blog post helps you learn something.
Now I’d like to turn it over to you:
What did you like about this tutorial?
Or maybe you have an excellent idea that you think I need to add.
Either way, let me know by leaving a comment below right now.

Mohamed Ouamer
Mohamed Ouamer is a computer science teacher and a self-published author. He taught networking technologies and programming for more than fifteen years. While he loves to share knowledge and write, Mohamed's best passions include spending time with his family, visiting his parents, and learning new things.