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 continuing, 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 the router’s hostnames and IP addresses according to the following table

DeviceInterfaceIP Address/Subnet Mask
R1loopback 010.0.1.1/24
Gigabitethernet 0/010.0.0.1/24
Gigabitethernet 0/210.0.12.1/24
R2loopback 010.0.2.2/24
loopback 110.0.20.2/24
Gigabitethernet 0/010.0.0.2/24
Gigabitethernet 0/110.0.12.2/24
R3loopback 010.0.3.3/24
loopback 110.0.30.3/24
loopback 210.0.31.3/24
Gigabitethernet 0/010.0.0.3/24
Gigabitethernet 0/210.0.34.3/24
R4loopback 010.0.4.4/24
loopback 110.0.40.4/24
loopback 210.0.41.4/24
loopback 310.0.42.4/24
Gigabitethernet 0/010.0.0.4/24
Gigabitethernet 0/310.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 assign all interfaces to 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 builds up neighbor relationships with its adjacent nodes

As shown in the show ip ospf neighbor output below, each router establishes four neighbor relationships. R1 and R2 establish three full relationships each. However, they do not establish an OSPF neighbor relationship with each other in subnet 10.0.0.0/24 because they are both DROther routers in that subnet. On multi-access data links where DR/BDR elections occur, DROther (non-DR/BDR) nodes do not build full OSPF neighbor relationships with each other.

On the other hand, routers R3 and R4 form OSPF adjacencies with all neighbors because they are either the Designated Router (DR) or the Backup Designated Router (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 has learned all the routes that other OSPF nodes have advertised

The number of routes that each router should learn is equal to 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 shows the number of routes each router must learn, and the show ip route ospf command displays those routes.

RouterNumber of OSPF-Enabled InterfacesNumber of OSPF Routes That Should Be Learned
R1310
R249
R358
R467

 

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: Based on the following table, modify the OSPF router IDs and ensure that the changes take effect

RouterRouter ID
R11.1.1.1
R22.2.2.2
R33.3.3.3
R44.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 from the outputs of the show ip ospf command below, OSPF is working with 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 the loopback interfaces get advertised in OSPF with their real subnet masks

By default, OSPF advertises loopback interfaces with a /32 subnet mask. To instruct OSPF to advertise the actual subnet mask, set the network type to point-to-point; this is the only value that can be assigned to loopback interfaces. If you attempt to set the network type of a loopback interface to broadcast, non-broadcast, or point-to-multipoint, Cisco IOS will reject the action and display 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 only two routers 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 use the show ip ospf database router command to display Type-1 LSAs on any router and 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: Verify that router R4 can ping IP addresses configured on routers R1, R2, and R3

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 on a separate 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. Use the tclquit command to exit the TCL shell.

R4(tcl)# tclquit

The following output will be generated once you finish.

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 the designated router (DR) in subnet 10.0.0.0/24

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

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

The output of the show ip ospf interface command below indicates that our configuration took effect. However, Router R4 is still the Designated Router (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)

In order to elect R3 as the DR, we must restart R4’s OSPF process.

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

Router R3 has been elected the Designated Router (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 to point-to-point for subnets 10.0.12.0/24 and 10.0.34.0/24

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 reference bandwidth is 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 100 Mbps, which is the default value.

Task 11: Set the OSPF reference bandwidth to 10 Gbps 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 bandwidth to calculate its cost. In Cisco IOS, the OSPF cost is equal to 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 instance, with a reference bandwidth of 100 Mbps and a bandwidth of 1,544 kbps, the OSPF cost is 64, which is the integer part of 100/1.544 (equaling 64.77).

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

The reference bandwidth is 10 Gbps, and R1’s G0/0 interface has a bandwidth of 1 Gbps. Therefore, applying the formula discussed in the previous task yields a new OSPF cost of 10 for the interface, 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 Hello paackets on all loopback interfaces

The passive-interface command enables network engineers to prevent a router from sending OSPF Hello packets over a specific interface or all 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, respectively, 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 the accumulated 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 output of the traceroute command shows that the path of router R4 to the IP address 10.0.1.1 crosses routers R3 and R1. The cumulative OSPF cost is the sum of R4’s G0/0 (10), R3’s G0/0 (10), and R1’s loopback0 (1) interface costs. Therefore, the path cost from R4 to R1’s loopback0 interface is 21, as shown by 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 uses the formula in Task 11 to calculate the interface cost. Since we cannot use the ip ospf cost command, we set the bandwidth of interface G0/0 to 5 Gbps so that the result of the formula is 2.

Router R3

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

We use the show ip ospf interface command to verify our configuration.

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 to router R3

InterfaceIP Address/Subnet Mask
Loopback310.0.32.3/24
Loopback410.0.33.3/24
Loopback510.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 into the OSPF routing domain so that the routers can access the loopback interfaces that were configured in the previous task.

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

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

Router R3

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

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

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 a metric type of 2 and a cost of 1 using an LSA of 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 Articles 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 tenured professor (professeur agrégé) in computer science 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.