OSPF Single Area Lab

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

Table of Contents

Goal

All IP addresses have been preconfigured for you.

  • The following loopback interfaces have been configured:
    • HongKong: 1.1.1.1 /24
    • Amsterdam: 2.2.2.2 /24
    • Barcelona: 3.3.3.3 /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 22.22.22.22, 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.

Topology

c4ospf1.png

Configuration

1

HongKong(config)#router ospf 1
HongKong(config-router)#network 0.0.0.0 255.255.255.255 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 1.1.1.0/24 network and the two 192 networks.

2

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

Amsterdam(config-router)#network 192.168.0.0 0.0.31.255 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 192.168.0.0 through 192.168.31.255.

3

Barcelona(config)#router ospf 1
Barcelona(config-router)#network 192.168.13.3 0.0.0.0 area 0
Barcelona(config-router)#network 192.168.23.3 0.0.0.0 area 0
Barcelona(config-router)#network 3.3.3.3 0.0.0.0 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.

4

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 1.1.1.1/24, Area 0
  Process ID 1, Router ID 1.1.1.1, 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

5

Amsterdam(config)#router ospf 1
Amsterdam(config-router)#router-id 22.22.22.22
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 22.22.22.22 on other routers.

6

Barcelona#sh ip route
[...]
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/2] via 192.168.13.1, 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
[...]
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/3] via 192.168.23.2, 00:00:05, FastEthernet1/0

7

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.

8

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.

9

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.

10

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.

11

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 0.0.0.0/0 [110/1] via 192.168.23.2, 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