OSPF Single Area Lab

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

Table of Contents


All IP addresses have been preconfigured for you.

  • The following loopback interfaces have been configured:
    • HongKong: /24
    • Amsterdam: /24
    • Barcelona: /24
  1. HongKong: Configure OSPF (process-id 1) and advertise all networks by using a single network statement. Use area0
  2. Amsterdam: Configure OSPF (process-id 1) and advertise all networks by using 2 network statements, area0.
  3. Barcelona: Configure OSPF (process-id 1) and advertise all networks by using 3 network statements, area0.
  4. Optional: the loopback interfaces appear as /32's in the routing table, make sure they appear as /24's just as you configured them.
  5. Amsterdam: change the router-id to, make sure you see this change from Barcelona by using show commands.
  6. Traffic from Barcelona to HongKong should use the link between Amsterdam-Barcelona, use the cost command to achieve this.
  7. Remove the previous change with the cost-command, achieve the same goal by using the bandwidth command.
  8. Enable clear-text authentication between Amsterdam and HongKong. Use "vault" as a password.
  9. Enable MD5 authentication between Barcelona and HongKong. Use "Safe" as a password.
  10. Change the OSPF timers on the link between Amsterdam and Barcelona so hello packets are being sent every 5 seconds.
  11. The HongKong router will have access to the Internet in the future, you need to advertise a default route in OSPF so Amsterdam and Barcelona will send traffic for unknown networks to HongKong.





HongKong(config)#router ospf 1
HongKong(config-router)#network area 0

In order to accomplish this using a single statement, all networks must be included. The statement above matches any network and is the only summary address big enough to encompass network and the two 192 networks.


Amsterdam(config)#router ospf 1
Amsterdam(config-router)#network area 0

Amsterdam(config-router)#network area 0

The first statement perfectly matches the loopback interface. The second statement is a summary that encompasses both 192.168 networks. The range matched by it is through


Barcelona(config)#router ospf 1
Barcelona(config-router)#network area 0
Barcelona(config-router)#network area 0
Barcelona(config-router)#network area 0

The network statements match only the IP address set on the interface, so all three interfaces will be included in the ospf process.


By default, loopbacks are treated as stub hosts, as shown by the following output:

HongKong#sh ip ospf int l0

Loopback0 is up, line protocol is up
  Internet Address, Area 0
  Process ID 1, Router ID, Network Type LOOPBACK, Cost: 1
  Loopback interface is treated as a stub Host

This behavior makes OSPF advertise these routes with the /32 mask. In order to change this behavior, we need to tell ospf that we want the interface to be treated as a point-to-point network. We will change the network type from LOOPBACK to POINT-TO-POINT.

HongKong(config)#int l0
HongKong(config-if)#ip ospf network point-to-point 

Amsterdam(config)#int l0
Amsterdam(config-if)#ip ospf network point-to-point

Barcelona(config)#int l0
Barcelona(config-if)#ip ospf network point-to-point


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

Modifying the router ID does not actually enforce the change until the process or the router is restarted. IOS tell you this when you configure a router ID. After restarting the OSPF process, all neighbor adjacencies are re-formed and the router ID of Amsterdam will be on other routers.


Barcelona#sh ip route
[...] is subnetted, 1 subnets
O [110/2] via, 00:06:58, FastEthernet0/0

Changing the metric will make Barcelona prefer the Amsterdam route. The current metric is 2. The route is advertised with metric 1 by HongKong and another 1 is added by Barcelona for the link between them. The route through Amsterdam will have metric 3, which means that we have to make the route through HongKong have a metric of 4 or higher.

Barcelona(config)#int f0/0
Barcelona(config-if)#ip ospf cost 3

The metric for that route is not 4, which means that the route through Amsterdam will make it into the routing table:

Barcelona#sh ip route
[...] is subnetted, 1 subnets
O [110/3] via, 00:00:05, FastEthernet1/0


Barcelona(config)#int f0/0
Barcelona(config-if)#no ip ospf cost
Barcelona(config-if)#bandwidth 33000

The OSPF cost per interface is calculated with this formula:

100 Mbps / Interface Bandwidth

Because the bandwidth is set to 100, the result is 1. In order to achieve a cost of 3, the bandwidth must be set accordingly. In case of 33 Mbps, the result is 3.03~, rounded to a cost of 3. The bandwidth command requires the number in Kbps.


HongKong(config)#int f0/0 
HongKong(config-if)#ip ospf authentication 
HongKong(config-if)#ip ospf authentication-key vault

Amsterdam(config)#int f0/0
Amsterdam(config-if)#ip ospf authentication
Amsterdam(config-if)#ip ospf authentication-key vault

The neighbor relationship does not immediately go down when the first command is entered because it will wait for the dead timer. The authentication will work if both sides have the same key. If a key will not set, the neighbor relationship will still form.


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

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

Same as 8. The authentication will work if both keys are the same or if no keys are configured on both devices.


Barcelona(config)#int f1/0
Barcelona(config-if)#ip ospf hello-interval 5

Amsterdam(config)#int f1/0
Amsterdam(config-if)#ip ospf hello-interval 5

The link will fail after the dead timer if the hello interval is not identical on both sides.


HongKong(config)#router ospf 1
HongKong(config-router)#default-information originate

HongKong will only advertise that default route if it actually has the default route. The OSPF process does not care where the route comes from, however. It could be a static route or a default route added to the table by another routing protocol.

I added a default route to loopback0 just to confirm that a route is advertised if it exists:

Barcelona#sh ip route
O*E2 [110/1] via, 00:00:26, FastEthernet1/0

The route is advertised as an External Type 2 route. These kind of routes do not have their metric modified as they are advertised in the OSPF domain.

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