OSPF Intermediate Lab

This lab was taken from gns3vault.com. Click here to go to the lab page.

Goal

All IP addresses have been preconfigured for you.

  1. Configure OSPF on all routers, achieve full connectivity. Make sure you can ping any IP Address from all routers. All networks should be in Area 0.
  2. Manually set the Router-ID of R1 to 1.1.1.2, make sure if you look at R2 or R3 that you really see the new router ID.
  3. Change OSPF so R3 becomes the designated router on the 192.168.34.X segment.
  4. Change the metric on the link between R1 and R2, do not use the ip ospf cost command for this.
  5. Change the reference bandwidth on all routers to 1500.
  6. Enable cleartext authentication between R2 and R4.
  7. Enable MD5 authentication between R3 and R4.
  8. On the link between R2 and R4, change the hello timer to 10 seconds and the dead-interval to 60 seconds.
  9. Insert a default route on R4 so that you see a 0.0.0.0/0 route in the routing table of R1, R2 and R3.
  10. Shutdown the link between R2 and R4.
  11. The link between R1 and R2, and R2's loopback interface should be configured as area 1.
  12. Configure area 1 as a not so stubby area (nssa).
  13. Configurea R4's loopback0 interface as area 2.
  14. Create 4 loopbacks on R4:
    • Loopback10: 172.16.0.1 /24
    • Loopback11: 172.16.1.1 /24
    • Loopback12: 172.16.2.1 /24
    • Loopback13: 172.16.3.1 /24
  15. Advertise these networks in OSPF area 2 but make sure you only see a single entry (172.16.0.0 /22) in the routing table of R1,R2 and R3.
  16. Create another loopback on R4:
    • Loopback14: 172.16.4.1 /24
  17. You are not allowed to advertise this loopback in OSPF or by using redistribution. Ensure other routers can reach this loopback.

Topology:

c4ospf2.png

Configuration

1

R1(config)#router ospf 1
R1(config-router)#net 1.1.1.1 0.0.0.0 area 0
R1(config-router)#net 192.168.12.1 0.0.0.0 area 0
R1(config-router)#net 192.168.13.1 0.0.0.0 area 0

R2(config)#router ospf 1
R2(config-router)#net 2.2.2.2 0.0.0.0 area 0
R2(config-router)#net 192.168.12.2 0.0.0.0 area 0
R2(config-router)#net 192.168.24.2 0.0.0.0 area 0

R3(config)#router ospf 1
R3(config-router)#net 3.3.3.3 0.0.0.0 area 0
R3(config-router)#net 192.168.13.3 0.0.0.0 area 0
R3(config-router)#net 192.168.34.3 0.0.0.0 area 0

R4(config)#router ospf 1
R4(config-router)#net 4.4.4.4 0.0.0.0 area 0
R4(config-router)#net 192.168.24.4 0.0.0.0 area 0
R4(config-router)#net 192.168.34.4 0.0.0.0 area 0

All network statements match the IP address on the interface exactly. The routes are present in all routing tables and pinging works between any two IP addresses.

2

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.2
Reload or use "clear ip ospf process" command, for this to take effect
R1(config-router)#do clear ip ospf process
Reset ALL OSPF processes? [no]: yes

The OSPF process must be reset in order for the change to take effect. All neighbor relationships will reset.

3

The DR/BDR are selected based on the highest router ID. R3's ID is 3.3.3.3, while R4's ID is 4.4.4.4. Router R3 needs to have a router ID if it is to become DR. There multiple ways of doing this. One would be to give R3 a 'bigger' IP address than 4.4.4.4, or to change the router ID to something bigger than 4.4.4.4. The better option is to manually set a priority on R3's interface. As long as it has the highest priority it will become DR no matter what.

R3(config)#int f1/0
R3(config-if)#ip ospf priority 2

R4#clear ip ospf process

Reset ALL OSPF processes? [no]: yes

Resetting the OSPF process is required on R4, because DR/BDR election is not preemptive. If R4 is the DR, it will stay the DR until it is reset.

4

OSPF's metric is cost. The OSPF cost per interface is calculated with this formula:

100 Mbps / Interface Bandwidth

In order for the metric on that link to change, both ends must be modified, otherwise routes coming one way would have the new cost while routes going the other way would have the old cost.

R1(config)#int f0/0
R1(config-if)#bandwidth 50000

R2(config)#int f0/0
R2(config-if)#bandwidth 50000

5

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

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

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

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

The reference bandwidth is the bandwidth used in the OSPF cost formula. The default is 100 Mbps. With a reference bandwidth of 1500, the new formula is:

1500 Mbps / Interface Bandwidth

All routes now add a cost of 15 per link and the ones passing through the R1-R2 link which was set to 50 Mbps bandwidth add a cost of 30.

6

R2(config)#int f1/0
R2(config-if)#ip ospf authentication
R2(config-if)#ip ospf authentication-key cisco

R4(config)#int f1/0
R4(config-if)#ip ospf authentication
R4(config-if)#ip ospf authentication-key cisco

The authentication also works if neither side has an authentication key configured.

7

R3(config)#int f1/0
R3(config-if)#ip ospf authentication message-digest 
R3(config-if)#ip ospf message-digest-key 1 md5 cisco

R4(config)#int f0/0
R4(config-if)#ip ospf authentication message-digest 
R4(config-if)#ip ospf message-digest-key 1 md5 cisco

Like clear text authentication, it works if no keys are configured.

8

R2(config)#int f1/0
R2(config-if)#ip ospf dead-interval 60
R2(config-if)#ip ospf hello-interval 10

R4(config)#int f1/0
R4(config-if)#ip ospf dead-interval 60
R4(config-if)#ip ospf hello-interval 10

The hello-interval command is not really required because the hello timer is already 10 by default.

9

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

The OSPF process only propagates a default route if it actually knows how to get to it and it does not care where the information came from. In order to force an OSPF router to advertise default routes even if it doesn't know how to get to them, the keyword 'always' must be used.

10

R2(config)#int f1/0
R2(config-if)#shut

Shutting down the interface on one end is enough.

11

R2(config)#router ospf 1
R2(config-router)#net 192.168.12.2 0.0.0.0 area 1
R2(config-router)#net 2.2.2.2 0.0.0.0 area 1

R1(config)#router ospf 1
R1(config-router)#net 192.168.12.1 0.0.0.0 area 1

12

R1(config)#router ospf 1
R1(config-router)#area 1 nssa
R2(config)#router ospf 1
R2(config-router)#area 1 nssa

Both routers must have area 1 configured as a nssa, otherwise the relationship will not form.

13

R4(config)#router ospf 1
R4(config-router)#net 4.4.4.4 0.0.0.0 area 2

This overwrites the old entry and the interface is assigned to area 2.

14

Creating the loopbacks:

R4(config)#int l1
R4(config-if)#ip add 172.16.0.1 255.255.255.0
R4(config)#int l2
R4(config-if)#ip add 172.16.1.1 255.255.255.0
R4(config)#int l3
R4(config-if)#ip add 172.16.2.1 255.255.255.0
R4(config)#int l4
R4(config-if)#ip add 172.16.3.1 255.255.255.0

Advertising into OSPF as area 2:

R4(config)#router ospf 1
R4(config-router)#net 172.16.0.1 0.0.0.0 area 2
R4(config-router)#net 172.16.1.1 0.0.0.0 area 2
R4(config-router)#net 172.16.2.1 0.0.0.0 area 2
R4(config-router)#net 172.16.3.1 0.0.0.0 area 2

15

R4(config)#router ospf 1
R4(config-router)#area 2 range 172.16.0.0 255.255.252.0

In config-router mode, there is also the command 'summary-address'. This will not work for summarizing routers from area 2. This command is used to summarize routes that are redistributed into OSPF (routes originating from the 'redistribute' command).

16

R4(config)#int l4
R4(config-if)#ip add 172.16.4.1 255.255.255.0

17

The other routers can already reach the 172.16.4.1 loopback because router R4 knows about it and all other routers have a default route pointing to R4 from exercise 9.

If there were no such route, an alternative to accomplishing this task would be to modify the range from exercise 15 to include this subnet as well. The other routers would have a summary route of 172.16.0.0/21 pointing to R4 and R4 knows how to reach the 172.16.4.0/24 subnet, thus achieving connectivity.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License