Configuring Basic OSPF (Dynamips)
Written by jlgaddis on November 25, 2008 – 3:21 am -In this lab, we have three routers at multiple locations that are connected through a switch, as shown in the diagram below:

We have been tasked with setting up OSPF on this network, with a few specific requirements:
- We must ensure that the ISP router is the designated router (DR)
- We must ensure that the Remote1 router is the backup designated router (BDR)
- We must ensure that the Remote2 router never participates in the election process
- Each router’s OSPF router ID should be the IP address of its FastEthernet 0/0 interface
- The ISP router should use its Loopback 0 interface as its default route and should advertise this default route through OSPF
The IP addresses that we will be using are as follows:
| Device | Interface | IP Address | Subnet Mask |
|---|---|---|---|
| ISP | FastEthernet 0/0 | 10.10.10.1 | 255.255.255.248 |
| Loopback 0 | 188.46.37.254 | 255.255.255.252 | |
| Remote1 | FastEthernet 0/0 | 10.10.10.3 | 255.255.255.248 |
| Loopback 0 | 192.168.1.1 | 255.255.255.192 | |
| Loopback 1 | 192.168.1.161 | 255.255.255.240 | |
| Remote2 | FastEthernet 0/0 | 10.10.10.2 | 255.255.255.248 |
| Loopback 0 | 192.168.1.65 | 255.255.255.192 | |
| Loopback 1 | 192.168.1.129 | 255.255.255.224 |
The Dynagen .net file that we’re using for this lab is as follows:
autostart = False
[localhost:7200]
workingdir = /home/jlgaddis/dynamips/working/ospf-lab
[[3640]]
image = /home/jlgaddis/dynamips/ios/c3640-js-mz.124-17.img
idlepc = 0x604c37fc
ram = 128
disk0 = 8
disk1 = 0
mmap = true
ghostios = true
[[router ISP]]
model = 3640
console = 2000
slot0 = NM-1FE-TX
fa0/0 = SW 10
[[router Remote1]]
model = 3640
console = 2001
slot0 = NM-1FE-TX
fa0/0 = SW 1
[[router Remote2]]
model = 3640
console = 2002
slot0 = NM-1FE-TX
fa0/0 = SW 24
[[ethsw SW]]
1 = access 1
10 = access 1
24 = access 1
With all necessary information in hand and our lab configured, let’s get started!
Configuring the interfaces
Our first step will be to configure the interfaces on all three routers with the IP addressing information in the table above. This should be fairly straightforward.
ISP# configure terminal
ISP(config)# interface fastethernet 0/0
ISP(config-if)# ip address 10.10.10.1 255.255.255.248
ISP(config-if)# no shutdown
ISP(config-if)# interface loopback 0
ISP(config-if)# ip address 188.46.37.254 255.255.255.252
ISP(config-if)# end
ISP#
Remote1# configure terminal
Remote1(config)# interface fastethernet 0/0
Remote1(config-if)# ip address 10.10.10.3 255.255.255.248
Remote1(config-if)# no shutdown
Remote1(config-if)# interface loopback 0
Remote1(config-if)# ip address 192.168.1.1 255.255.255.192
Remote1(config-if)# interface loopback 1
Remote1(config-if)# ip address 192.168.1.161 255.255.255.240
Remote1(config-if)# end
Remote1#
Remote2# configure terminal
Remote2(config)# interface fastethernet 0/0
Remote2(config-if)# ip address 10.10.10.2 255.255.255.248
Remote2(config-if)# no shutdown
Remote2(config-if)# interface loopback 0
Remote2(config-if)# ip address 192.168.1.65 255.255.255.192
Remote2(config-if)# interface loopback 1
Remote2(config-if)# ip address 192.168.1.129 255.255.255.224
Remote2(config-if)# end
Remote2#
Verifying connectivity
From the ISP router, we should now be able to ping the Remote1 and Remote2 routers:
ISP# ping 10.10.10.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 20/42/96 ms
ISP# ping 10.10.10.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/33/84 ms
ISP#
Configuring basic OSPF
Let’s get started with the OSPF configuration. For now, we won’t worry about the DR/BDR or router-id requirements, we just want to get our OSPF adjacencies up. We DO want to advertise all networks, including the Loopback interfaces, into the backbone area (“Area 0″):
ISP# configure terminal
ISP(config)# router ospf 1
ISP(config-router)# network 188.46.37.252 0.0.0.3 area 0
ISP(config-router)# network 10.10.10.0 0.0.0.7 area 0
ISP(config-router)# end
ISP#
Remote1# configure terminal
Remote1(config)# router ospf 1
Remote1(config-router)# network 192.168.1.0 0.0.0.63 area 0
Remote1(config-router)# network 192.168.1.160 0.0.0.15 area 0
Remote1(config-router)# network 10.10.10.0 0.0.0.7 area 0
Remote1(config-router)# end
Remote1#
Remote2# configure terminal
Remote2(config)# router ospf 1
Remote2(config-router)# network 192.168.1.64 0.0.0.63 area 0
Remote2(config-router)# network 192.168.1.128 0.0.0.31 area 0
Remote2(config-router)# network 10.10.10.0 0.0.0.7 area 0
Remote2(config-router)# end
Remote2#
Verifying OSPF adjacencies
Shortly after configuring OSPF as above, we should have seen log messages on our console, letting us know that the OSPF adjacencies had been established. Each router should have established an adjacency with the other two. Let’s take a look:
ISP# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.129 1 FULL/DROTHER 00:00:38 10.10.10.2 FastEthernet0/0
192.168.1.161 1 FULL/BDR 00:00:36 10.10.10.3 FastEthernet0/0
ISP#
Remote1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
188.46.37.254 1 FULL/DR 00:00:32 10.10.10.1 FastEthernet0/0
192.168.1.129 1 FULL/DROTHER 00:00:38 10.10.10.2 FastEthernet0/0
Remote1#
Remote2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
188.46.37.254 1 FULL/DR 00:00:32 10.10.10.1 FastEthernet0/0
192.168.1.161 1 FULL/BDR 00:00:36 10.10.10.3 FastEthernet0/0
Remote2#
Looks like our adjacencies have formed just as we intended.
Configuring OSPF Router IDs
As mentioned in our requirements:
“Each router’s OSPF router ID should be the IP address of its FastEthernet 0/0 interface”
Because we are 1) in a Cisco environment and 2) using loopback interfaces, this will definitely not be the case. According to Cisco (see page three):
“The OSPF router ID is a 32-bit IP address selected at the start of the OSPF process. The highest IP address configured on the router is the router ID. If a loopback address is configured, it is the router ID. In the case of multiple loopback addresses, the highest loopback address is the router ID. Once the router ID is elected, it does not change unless OSPF restarts or is manually changed with the router-id command.”
Since each router has at least one loopback interface, the default router ID chosen will not be the one that our requirements dictate. Let’s configure them manually:
ISP# configure terminal
ISP(config)# router ospf 1
ISP(config-router)# router-id 10.10.10.1
Reload or use "clear ip ospf process" command, for this to take effect
ISP(config-router)# end
ISP#
Remote1# configure terminal
Remote1(config)# router ospf 1
Remote1(config-router)# router-id 10.10.10.3
Reload or use "clear ip ospf process" command, for this to take effect
Remote1(config-router)# end
Remote1#
Remote2# configure terminal
Remote2(config)# router ospf 1
Remote2(config-router)# router-id 10.10.10.2
Reload or use "clear ip ospf process" command, for this to take effect
Remote2(config-router)# end
Remote2#
Note that IOS warned us that the router ID will not change until the OSPF process restarts (either manually or via a router reload). We’ll hold off on that for now.
Meeting the designated router (DR)/backup designated router (BDR) requirements
From the output of “show ip ospf neighbor” above, we can tell that the ISP router has been elected as our DR and that the Remote1 router has been elected as our BDR. This is merely a result of the order in which we configured the routers (and, subsequently, the order in which the adjacencies formed). To fully meet the requirements, we must ensure that, under normal circumstances, the ISP router will be the DR, the Remote1 router will be the BDR, and that the Remote2 will never even attempt to participate in the election process.
This is actually pretty easy to configure and can be done by setting OSPF priorities.
First, to ensure that the ISP router will be the DR, we’ll give it the highest possible OSPF priority (note that this is configured under the appropriate interface):
ISP# configure terminal
ISP(config)# interface fastethernet 0/0
ISP(config-if)# ip ospf priority 255
ISP(config-if)# end
ISP#
Next, to ensure that the Remote2 router never participates in the election process we can set its OSPF priority to zero:
Remote2# configure terminal
Remote2(config)# interface fastethernet 0/0
Remote2(config-if)# ip ospf priority 0
Remote2(config-if)# end
Remote2#
With our current configuration, the Remote1 router will always end up as the BDR. What if, however, we later added another router to the network. Because it would, by default, also have an OSPF priority of 1, it is possible that it could take over the role of BDR. While, according to our requirements, changing Remote1’s OSPF priority is not needed, let’s set it to 254 just for good measure:
Remote1# configure terminal
Remote1(config)# interface fastethernet 0/0
Remote1(config-if)# ip ospf priority 254
Remote1(config-if)# end
Remote1#
Restarting the OSPF process
At this point, we should be in good shape and have met all requirements except one. Let’s go ahead and restart the OSPF process on each router to have our changes (OSPF priorities and router IDs) take effect. I’ll restart them in the following order to ensure the elections result in our desired configuration: ISP, Remote1, Remote2.
ISP# clear ip ospf process
Reset OSPF process? [no]: yes
ISP#
Remote1# clear ip ospf process
Reset OSPF process? [no]: yes
Remote1#
Remote2# clear ip ospf process
Reset OSPF process? [no]: yes
Remote2#
We should see our adjacencies go down and new adjacencies form using the new OSPF router IDs. From the ISP router, we can verify that the new router IDs are being used and also see which routers have our DR and BDR roles:
ISP# show ip ospf interface fastethernet 0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.10.10.1/29, Area 0
Process ID 1, Router ID 10.10.10.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR, Priority 255
Designated Router (ID) 10.10.10.1, Interface address 10.10.10.1
Backup Designated router (ID) 10.10.10.3, Interface address 10.10.10.3
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:08
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 10.10.10.2
Adjacent with neighbor 10.10.10.3 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
ISP#
Verifying advertisement of OSPF routes:
Let’s take a look at the routing table on each router to ensure that our routes are being advertised throughout the OSPF area:
ISP# show ip route
Codes: 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
Gateway of last resort is not set
188.46.0.0/30 is subnetted, 1 subnets
C 188.46.37.252 is directly connected, Loopback0
10.0.0.0/29 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, FastEthernet0/0
192.168.1.0/32 is subnetted, 4 subnets
O 192.168.1.65 [110/2] via 10.10.10.2, 00:01:53, FastEthernet0/0
O 192.168.1.1 [110/2] via 10.10.10.3, 00:01:53, FastEthernet0/0
O 192.168.1.161 [110/2] via 10.10.10.3, 00:01:53, FastEthernet0/0
O 192.168.1.129 [110/2] via 10.10.10.2, 00:01:53, FastEthernet0/0
ISP#
Remote1# show ip route
Codes: 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
Gateway of last resort is not set
188.46.0.0/32 is subnetted, 1 subnets
O 188.46.37.254 [110/2] via 10.10.10.1, 00:01:53, FastEthernet0/0
10.0.0.0/29 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, FastEthernet0/0
192.168.1.0/24 is variably subnetted, 4 subnets, 3 masks
O 192.168.1.65/32 [110/2] via 10.10.10.2, 00:01:53, FastEthernet0/0
C 192.168.1.0/26 is directly connected, Loopback0
C 192.168.1.160/28 is directly connected, Loopback1
O 192.168.1.129/32 [110/2] via 10.10.10.2, 00:01:53, FastEthernet0/0
Remote1#
Remote2# show ip route
Codes: 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
Gateway of last resort is not set
188.46.0.0/32 is subnetted, 1 subnets
O 188.46.37.254 [110/2] via 10.10.10.1, 00:01:53, FastEthernet0/0
10.0.0.0/29 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, FastEthernet0/0
192.168.1.0/24 is variably subnetted, 4 subnets, 3 masks
C 192.168.1.64/26 is directly connected, Loopback0
O 192.168.1.1/32 [110/2] via 10.10.10.3, 00:01:53, FastEthernet0/0
O 192.168.1.161/32 [110/2] via 10.10.10.3, 00:01:53, FastEthernet0/0
C 192.168.1.128/27 is directly connected, Loopback1
Remote2#
Okay, our routing tables look good; all networks are being advertised and we should have full connectivity.
Default route requirement
Our last requirement states:
“The ISP router should use its Loopback 0 interface as its default route and should advertise this default route through OSPF”
Easy enough, right? Let’s do it:
ISP# configure terminal
ISP(config)# ip route 0.0.0.0 0.0.0.0 loopback 0
ISP(config)# router ospf 1
ISP(config-router)# default-information originate
ISP(config-router)# end
ISP#
Verify default route on ISP router
First, let’s make sure the default route made it into the routing table on the ISP router:
ISP# show ip route | include 0.0.0.0/0
S* 0.0.0.0/0 is directly connected, Loopback0
ISP#
Excellent! A default route has been configured. Let’s make sure it’s being propagated to the other two routers:
Remote1# show ip route | include 0.0.0.0/0
O*E2 0.0.0.0/0 [110/1] via 10.10.10.1, 00:03:23, FastEthernet0/0
Remote1#
Remote2# show ip route | include 0.0.0.0/0
O*E2 0.0.0.0/0 [110/1] via 10.10.10.1, 00:03:23, FastEthernet0/0
Remote2#
Awesome! The default route on ISP router is being advertised into OSPF and picked up by the Remote1 and Remote2 routers.
We’ve now met all the requirements of the lab — our work here is done.
Be sure and save your configurations, next time we add OSPF authentication to prevent unauthorized routing updates.
See you next time!
Tags: ccna, cisco, labs, networking, ospf | 12 Comments »




November 25th, 2008 at 3:29 am
After posting this, I ran into a couple of formatting issues because I originally had an underscore between “Remote” and “1″ and “2″ in the router names (due to having a Wordpress plugin for Markdown installed). I did a search and replace to change the router names to “Remote1″ and “Remote2″, but if you run into any consistencies that’s why.
Thanks, Jeremy
November 26th, 2008 at 1:17 am
[...] Twitter Updates « Configuring Basic OSPF (Dynamips) [...]
January 6th, 2009 at 3:24 am
I came across this article moments after reading up on OSPF. I was actually looking for lab/scenarios to play around with. The lab on this article is excellent. However part of the findings/requirements are wrong and probably can’t be met.
the requirement to have the ISP router as the DR and Remote2 as the BDR even under normal circumstances can’t be met simply because if the DR goes off for some reason, the BDR will be upgraded to DR and it will stay that way. My point is I don’t know of any automated way to do this. I re-did your lab and posted my findings. I hope you don’t mind: I hope we’re both wrong and someone corrects us….:-)
http://third-world-networker.blogspot.com Regards, Gitau
January 6th, 2009 at 7:05 am
http://third-world-networker.blogspot.com/2009/01/understanding-ospf.html
thats the full url….incase you read this after several updates on my main page.
thanks
January 6th, 2009 at 8:03 am
@JG:
You’re quite correct that there is no way to ensure that a specific router will always be the BDR because it will be “promoted”, as you mentioned, to DR if/when the DR goes away.
Quote from the post:
“To fully meet the requirements, we must ensure that, under normal circumstances, the ISP router will be the DR, the Remote1 router will be the BDR, and that the Remote2 will never even attempt to participate in the election process.”
I’m not sure it’s possible to have a BDR that would never become a DR — I’m quite certain it’s not, as that would defeat the whole purpose of a BDR.
That said, this was a very introductory lab modified just slightly from a Cisco Network Academy lab for OSPF. I made it specifically for a friend of mine who is in that program, but posted it here “for the world”. I think you read a bit more into it than I expected the “intended audience” would.
“I re-did your lab and posted my findings. I hope you don’t mind.”
Not at all. I’m no expert on anything about which I post. If I’m wrong, I hope that others do, indeed, point out my mistakes. It will only benefit all of us who come across these articles!
January 6th, 2009 at 8:07 am
@JG
FYI, I tried posting a comment on your site as well, but couldn’t post for some reason.
Thanks, -j
January 6th, 2009 at 12:47 pm
cool .. no worries and thanks .. the lab was fun and saved me tons of time creating a new one…I check on your blog every once in a while for interesting stuff … Not sure why the comments didn’t work, anyway, I enabled comments even for anonymous users — until spam gets to me… Gitau
January 6th, 2009 at 12:57 pm
Awesome, glad you find the useful helpful. I’ve got some good ideas for labs, just have to find the time to write ‘em out. I’m not sure what “level” you’re on, but I have some good ones on BGP in the works (about halfway done). Stay tuned and good luck on your studies!
January 21st, 2009 at 9:00 am
Good work Jeremy and I followed everything here and it works fine. I will continue to follow your labs. Is this how the College is setup to connect to the ISP. Also the switch could be replaced with a Frame-Relay cloud?
February 18th, 2009 at 10:02 pm
This was a great example! But I have the same question as the the lost comment. Can this switch be a frame relay could and if so what would be the config for it?
March 19th, 2009 at 6:54 am
I was seriously looking for some ospf config labs in dynamips environment and Google flashed me this website and I sincerely thankful to the author for his valuable help on this
March 20th, 2009 at 6:10 pm
Sorry for the late responses, everybody…
@AK: Not quite. We don’t have any frame-relay anymore (haven’t for years). We have probably 70 sites altogether. The larger sites have a fiber connection back to one of two central sites (we run OSPF over these links). These sites also have (typically, multiple) T-1’s into AT&T’s MPLS cloud and that traffic exits the MPLS cloud at the other central site (whichever one their fiber doesn’t run to).
The switch could be replaced with a frame-relay cloud, however the OSPF configuration would be different (think about your different types of OSPF network types).
@Edwin Jean: The OSPF configurations would depend on the OSPF network types in use, which would depend on the frame-relay configurations, e.g. one large point-to-multipoint, or multiple point-to-points, etc. I’ll try to post more example configurations soon with the different network types.
@Prithivi: You’re very welcome! Visit again soon and I’ll work on getting some more “labs” posted.
-Jeremy