Single Area OSPF Lab: Merida Vargas
Single Area OSPF Lab: Merida Vargas
Non-OSPF link
172.16.2.0/24 192.168.20.4/30
Scenario:
• Loopback0 is used for RouterID
• Loopback1 is a virtual network
• Loopback2 is a virtual network
• Note: OSPF routes loopback networks as /32 host routes.
Objective
• Configure OSPF so both routers will have the correct networks in their routing
tables.
1
Part 1 – Basic OSPF Configuration
Preconfigurations
Merida
!
interface Loopback0 RouterID
ip address 200.0.0.1 255.255.255.255
!
interface Loopback1 Virtual Network
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2 Virtual Network
ip address 172.16.2.1 255.255.255.0
!
interface FastEthernet0
ip address 192.168.20.2 255.255.255.252
!
line con 0
exec-timeout 0 0
logging synchronous
Vargas
!
interface Loopback0 RouterID
ip address 201.0.0.1 255.255.255.255
!
interface Loopback1 Virtual Network
ip address 192.168.30.1 255.255.255.0
!
interface Loopback2 Virtual Network
ip address 192.168.20.5 255.255.255.252
!
interface FastEthernet0
ip address 192.168.20.1 255.255.255.252
!
line con 0
exec-timeout 0 0
logging synchronous
2
Step 1: Enabling OSPF
On the Merida, enable OSPF to run on each interface. There are several ways to do this,
but the commands below specify each individual subnet. Notice that the process IDs do
not have to be the same on both routers.
Merida(config)#router ospf 1
Merida(config-router)#network 172.16.1.0 0.0.0.255 area 0
Merida(config-router)#network 172.16.2.0 0.0.0.255 area 0
Merida(config-router)#network 192.168.20.0 0.0.0.3 area 0
Vargas(config)#router ospf 10
Vargas(config-router)#network 192.168.20.0 0.0.0.3 area 0
Vargas(config-router)#network 192.168.30.0 0.0.0.255 area 0
Notice, that Merida sees Vargas’ network of 192,168.30.0/24 but does not see
192.168.20.4/30. This is because Vargas did not include the network command to include
that network. Both routers display all other networks.
Merida#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
3
From Meridas’ perspective, there is a major network boundary (192.168.20.0/30) between
it and Vargas. As you can see in Vargas’ routing table, Meridas did not automatically
summarize the 172.16.1.0/24 and 172.16.2.0/24 networks, as a classful routing protocol
like RIP would do. OSPF does not automatically summarize routes. Smmarization must
be manually configured.
Vargas#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Merida#show ip protocols
Routing Protocol is "ospf 1"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: ospf 1
Routing for Networks:
172.16.1.0/24
172.16.2.0/24
192.168.20.0/30
Routing Information Sources:
Gateway Distance Last Update
201.0.0.1 110 00:27:51
Distance: (default is 110)
Merida#
4
If one router boots up first and elects itself as the DR before the other router is ready to
participate in the DR/BDR election process, you may see a router with a lower RouterID as
the DR. To force both routers to participate in the DR/BDR election process, you can
shutdown both FastEthernet interfaces, followed by a simultaneous no shutdown (or
within a few seconds of one another). Below, you can see that Vargas is the DR and
Merida is the BDR.
Merida#show ip ospf neighbor
Merida#show ip ospf
Routing Process "ospf 1" with ID 200.0.0.1
Supports only single TOS(TOS0) routes
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x0
Number of DCbitless external LSA 0
Number of DoNotAge external LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 3
Area has no authentication
SPF algorithm executed 7 times
Area ranges are
Number of LSA 3. Checksum Sum 0x1FB55
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Merida#
In Part 2 we will modify the priority of a FastEthernet interface on Merida to force Merida to
become the DR.
Merida(config)#inter fa 0
Merida(config-if)#ip ospf priority 10
Merida(config-if)#
Notice that nothing has changed. A new DR/BDR election process will not happen unless
both the DR and BDR fail. If the DR fails, the BDR will become the DR and a new election
process will be held for the BDR. In this case, the DR has not failed, so Vargas is still the
DR.
To force a new DR/BDR election process, we will shutdown both interfaces, followed by
simultaneous no shutdown commands (or by disconnecting the Ethernet cables). We will
also observe the DR/BDR election process with debug ip ospf adj (adjacency).
You will also see the different “Steps to OSPF Operation.”
Merida(config)#inter fa 0 Vargas(config)#inter fa 0
Merida(config-if)#shutdown Vargas(config-if)#shutdown
Merida(config)#inter fa 0 Vargas(config)#inter fa 0
Merida(config-if)#no shutdown Vargas(config-if)#no shutdown
Notice that Merida is now the DR and Vargas is now the BDR.
Merida#show ip ospf neighbor
7
Part 3 – Modifying the OSPF Cost with the ip ospf cost
command
In Part 3 we will modify the cost of an interface with the ip ospf cost command. We will
modify the cost of Loopback1 on Merida and notice the change in the cost for that route in
Vargas’s routing table.
8
Step 4: Notice the change to the cost on this interface:
Merida#show ip ospf interface loop 1
Loopback1 is up, line protocol is up
Internet Address 172.16.1.1/24, Area 0
Process ID 1, Router ID 200.0.0.1, Network Type LOOPBACK, Cost: 25
Loopback interface is treated as a stub Host
Merida#
The cost is the cumulative sum of the bandwidth, (Fa0) 1 + (Loopback1) 25 = 26.
Vargas#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
9
Part 4 – Modifying the OSPF Cost with bandwidth command
In Part 4 we will modify the cost of the FastEthernet interface between Merida and Vargas
with the bandwidth command on both routers. Both routers’ routing tables will be affected,
however we will look at the changes from Merida’s perspective.
10
Step 4: Modify the bandwidth of FastEthernet 0
Merida(config)#inter fa 0 Vargas(config)#inter fa 0
Merida(config-if)#bandwidth 10000 Vargas(config-if)#band 10000
Merida(config-if)# Vargas(config-if)#
11
Part 5 – Configuring Simple (Plain Text) Authentication
Merida#
Vargas#show ip ospf
Routing Process "ospf 10" with ID 201.0.0.1
Supports only single TOS(TOS0) routes
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x0
Number of DCbitless external LSA 0
Number of DoNotAge external LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 2
Area has no authentication
SPF algorithm executed 23 times
Area ranges are
Number of LSA 4. Checksum Sum 0x9EC8
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Vargas#
12
Step 2: Modify the FastEthernet interaces on both routers for Plain Text
Authentication.
Merida(config)#inter fa 0
Merida(config-if)#ip ospf authentication-key secret
Merida(config-if)#
Vargas(config)#inter fa 0
Vargas(config-if)#ip ospf authentication-key secret
Vargas(config-if)#
Step 3: Modify the OSPF on both routers for Plain Text Authentication.
Merida(config)#router ospf 1
Merida(config-router)#area 0 authentication
Merida(config-router)#
Vargas(config)#router ospf 10
Vargas(config-router)#area 0 authentication
Vargas(config-router)#
Merida#
13
Merida#show ip ospf neighbor
Merida#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Merida#ping 192.168.30.1
14
Part 6 – Configuring MD5 Encrypted Authentication
Note: debug ip ospf adj is an excellent command to use to locate problems with
mismatched authentication types or authentication keys.
Merida(config)#router ospf 1
Merida(config-router)#no area 0 authentication
Merida(config-router)#
Vargas(config)#int fa 0
Vargas(config-if)#no ip ospf authentication-key secret
Vargas(config-if)#
Vargas(config)#router ospf 10
Vargas(config-router)#no area 0 authentication
Vargas(config-router)#
Step 2: Modify the FastEthernet interaces on both routers for MD5 Encrypted
Authentication.
Merida(config)#inter fa 0
Merida(config-if)#ip ospf message-digest-key 1 md5 secret
Merida(config-if)#
Vargas(config)#inter fa 0
Vargas(config-if)#ip ospf message-digest-key 1 md5 secret
Vargas(config-if)#
Step 3: Modify the OSPF on both routers for MD5 Encrypted Authentication.
Merida(config)#router ospf 1
Merida(config-router)#area 0 authentication message-digest
Merida(config-router)#
Vargas(config)#router ospf 10
Vargas(config-router)#area 0 authentication message-digest
Vargas(config-router)#
15
Step 4: Verify MD5 Encrypted Authentication.
Merida#show ip ospf
Routing Process "ospf 1" with ID 200.0.0.1
Supports only single TOS(TOS0) routes
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x0
Number of DCbitless external LSA 0
Number of DoNotAge external LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 3
Area has message digest authentication
SPF algorithm executed 27 times
Area ranges are
Number of LSA 4. Checksum Sum 0x184D3
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Merida#
Merida#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Merida#ping 192.168.30.1
16
Part 7 – Configuring Hello and Dead Timers
To form and maintain an adjacency with another router, OSPF Hello and Dead timers
must match.
Merida#show ip ospf inter fa 0
FastEthernet0 is up, line protocol is up
Internet Address 192.168.20.2/30, Area 0
Process ID 1, Router ID 200.0.0.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 10
Designated Router (ID) 200.0.0.1, Interface address 192.168.20.2
Backup Designated router (ID) 201.0.0.1, Interface address 192.168.20.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:00
Index 3/3, 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 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 201.0.0.1 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
Message digest authentication enabled
Youngest key id is 1
Merida#
17
Step 2: Modify Merida’s Hello timer for a mismatch.
You should never modify the OSPF timers unless you have a compelling reason to do so. We
will modify Merida’s Hello timer from the default of 10 seconds to 5 seconds, so it does
not match Verida. The debug ip ospf events command will show us that there is a
timer mismatch problem.
Merida#debug ip ospf events
OSPF events debugging is on
Merida#conf t
Merida(config)#inter fa 0
Merida(config-if)#ip ospf hello-interval 5
Merida(config-if)#end
Merida#
08:00:56: OSPF: Rcv hello from 201.0.0.1 area 0 from FastEthernet0 192.168.20.1
08:00:56: OSPF: Mismatched hello parameters from 192.168.20.1
08:00:56: Dead R 40 C 20, Hello R 10 C 5 Mask R 255.255.255.252 C 255.255.255.2
52
Merida#
You will notice that the Dead Interval timer changed automatically, to four times the new
Hello interval, 20 seconds.
Merida#show ip ospf inter fa 0
FastEthernet0 is up, line protocol is up
Internet Address 192.168.20.2/30, Area 0
Process ID 1, Router ID 200.0.0.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 10
Designated Router (ID) 200.0.0.1, Interface address 192.168.20.2
No backup designated router on this network
Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5
Hello due in 00:00:00
Index 3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 2, maximum is 2
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Message digest authentication enabled
Youngest key id is 1
Merida#
18
Step 4: Verify loss of adjacency between Merida and Vargas.
Notice that Vargas is no longer a adjacent neighbor and the routes via Vargas are no
longer reachable.
Merida#
Merida#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
While debug ip ospf events is enabled, we will modify Varga’s Hello (and Dead)
timer to match Merida. After the change, you will notice the adjacency taking place and
the “Steps to OSPF Operation.”
Vargas#debug ip ospf events
OSPF events debugging is on
08:10:28: OSPF: Rcv hello from 200.0.0.1 area 0 from FastEthernet0 192.168.20.2
08:10:28: OSPF: Mismatched hello parameters from 192.168.20.2
08:10:28: Dead R 20 C 40, Hello R 5 C 10 Mask R 255.255.255.252 C 255.255.255.2
52
Vargas#conf t
Vargas(config)#inter fa 0
Vargas(config-if)#ip ospf hello-interval 5
Vargas(config-if)#end
08:10:48: OSPF: Rcv hello from 200.0.0.1 area 0 from FastEthernet0 192.168.20.2
08:10:48: OSPF: End of hello processing
08:10:49: %SYS-5-CONFIG_I: Configured from console by console
08:10:52: OSPF: Send with youngest Key 1
08:10:52: OSPF: Rcv DBD from 200.0.0.1 on FastEthernet0 seq 0x70A opt 0x2 flag 0
x7 len 32 mtu 1500 state INIT
08:10:52: OSPF: 2 Way Communication to 200.0.0.1 on FastEthernet0, state 2WAY
08:10:52: OSPF: Neighbor change Event on interface FastEthernet0
08:10:52: OSPF: DR/BDR election on FastEthernet0
08:10:52: OSPF: Elect BDR 0.0.0.0
08:10:52: OSPF: Elect DR 200.0.0.1
19
08:10:52: OSPF: Elect BDR 201.0.0.1
08:10:52: OSPF: Elect DR 200.0.0.1
08:10:52: DR: 200.0.0.1 (Id) BDR: 201.0.0.1 (Id)
08:10:52: OSPF: Send DBD to 200.0.0.1 on FastEthernet0 seq 0x1E6E opt 0x2 flag 0
x7 len 32
08:10:52: OSPF: Send with youngest Key 1
08:10:52: OSPF: Set FastEthernet0 flush timer
08:10:52: OSPF: Remember old DR 201.0.0.1 (id)
08:10:52: OSPF: First DBD and we are not SLAVE
08:10:52: OSPF: Rcv DBD from 200.0.0.1 on FastEthernet0 seq 0x1E6E opt 0x2 flag
0x2 len 72 mtu 1500 state EXSTART
08:10:52: OSPF: NBR Negotiation Done. We are the MASTER
08:10:52: OSPF: Send DBD to 200.0.0.1 on FastEthernet0 seq 0x1E6F opt 0x2 flag 0
x3 len 92
08:10:52: OSPF: Send with youngest Key 1
08:10:52: OSPF: Send with youngest Key 1
08:10:52: OSPF: Database request to 200.0.0.1
08:10:52: OSPF: sent LS REQ packet to 192.168.20.2, length 12
08:10:52: OSPF: Rcv DBD from 200.0.0.1 on FastEthernet0 seq 0x1E6F opt 0x2 flag
0x0 len 32 mtu 1500 state EXCHANGE
08:10:52: OSPF: Send DBD to 200.0.0.1 on FastEthernet0 seq 0x1E70 opt 0x2 flag 0
x1 len 32
08:10:52: OSPF: Send with youngest Key 1
08:10:52: OSPF: Send with youngest Key 1
08:10:52: OSPF: Rcv DBD from 200.0.0.1 on FastEthernet0 seq 0x1E70 opt 0x2 flag
0x0 len 32 mtu 1500 state EXCHANGE
08:10:52: OSPF: Exchange Done with 200.0.0.1 on FastEthernet0
08:10:52: OSPF: Synchronized with 200.0.0.1 on FastEthernet0, state FULL
08:10:52: OSPF: Send with youngest Key 1
08:10:53: OSPF: Rcv hello from 200.0.0.1 area 0 from FastEthernet0 192.168.20.2
08:10:53: OSPF: End of hello processing
08:10:53: OSPF: Send with youngest Key 1
08:10:55: OSPF: Send with youngest Key 1
08:10:57: OSPF: Send with youngest Key 1
08:10:57: OSPF: Send with youngest Key 1
08:10:58: OSPF: Send with youngest Key 1
08:10:58: OSPF: Rcv hello from 200.0.0.1 area 0 from FastEthernet0 192.168.20.2
08:10:58: OSPF: Neighbor change Event on interface FastEthernet0
08:10:58: OSPF: DR/BDR election on FastEthernet0
08:10:58: OSPF: Elect BDR 201.0.0.1
08:10:58: OSPF: Elect DR 200.0.0.1
08:10:58: DR: 200.0.0.1 (Id) BDR: 201.0.0.1 (Id)
08:10:58: OSPF: End of hello processing
08:11:00: OSPF: Send with youngest Key 1
08:11:02: OSPF: Send with youngest Key 1
08:11:03: OSPF: Rcv hello from 200.0.0.1 area 0 from FastEthernet0 192.168.20.2
08:11:03: OSPF: End of hello processing
08:11:07: OSPF: Send with youngest Key 1
08:11:08: OSPF: Rcv hello from 200.0.0.1 area 0 from FastEthernet0 192.168.20.2
08:11:08: OSPF: End of hello processing
Vargas#undebug all
All possible debugging has been turned off
Vargas#
21
Step 7: Verify the timer values.
Once again, you will notice that the Dead Interval timer changed automatically, to four
times the new Hello interval, 20 seconds. Both the Hello timer and the Dead timer now
match Merida.
22
Part 8 – Configuring a Default Route
Step 1: Add a static “quad-zero” route on Merida.
We will add a static quad-zero route on Merida. Since there is not another router, for
purposes of this lab we will forward all default traffic to null0, the “bit-bucket.”
Merida(config)#ip route 0.0.0.0 0.0.0.0 null0
Notice that the default route is in Merida’s routing table, but was not automatically
propagated by OSPF to Vargas.
Merida#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Vargas#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
23
Step 3: Propagate default route via OSPF
Use the default-information originate command to propagate the default route via
OSPF.
Merida(config)#router ospf 1
Merida(config-router)#default-information originate
Merida(config-router)#
Notice that the default route has now been propagated by OSPF to Vargas.
Vargas#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
24