ospf configuration lab

Posted: September 17, 2015 in CCNA
Tags: , , , ,

This is a ospf configuration lab tutorial in which i will explain how to configure ospf.OSPF is one of popular routing protocol and the main reason behind it is it’s property to support VLSM and CIDR.OSPF routing protocol converges very quickly and also guarantees loop free routing.It is famous  among ISP network because it’s open standard and supports almost every vendor hardware and softwares.

ospf configuration lab

Configuration on R1:

Router>enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#int fa0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut

 

R1(config-if)#exit
R1(config)#int se0/0/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#bandwidth 128
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#int se0/0/1
R1(config-if)#ip add 192.168.3.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#bandwidth 128
R1(config-if)#no shut

 

Configuration on R2:
Router>enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#int fa0/0
R2(config-if)#ip add 192.168.6.1 255.255.255.0
R2(config-if)#no shut

 

R2(config-if)#exit
R2(config)#int se0/0/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut

 

R2(config-if)#exit
R2(config)#int se0/0/1
R2(config-if)#ip add 192.168.4.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#bandwidth 128
R2(config-if)#no shut

 
Configuration on R3:
Router>enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R3
R3(config)#int fa0/0
R3(config-if)#ip add 192.168.5.1 255.255.255.0
R3(config-if)#no shut

 

R3(config-if)#exit
R3(config)#int se0/0/0
R3(config-if)#ip add 192.168.3.2 255.255.255.0
R3(config-if)#no shut

R3(config-if)#exit
R3(config)#int se0/0/1
R3(config-if)#ip add 192.168.4.2 255.255.255.0
R3(config-if)#no shut

 

 

Configure OSPF on R1:

 

If  You want to run OSPF on a simple network.

 Configuring OSPF

You can enable OSPF on router by defining an OSPF process and assigning an address range to an area as follows:

R1(config)#router ospf 1
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.2.0 0.0.0.255 area 0
R1(config-router)#network 192.168.3.0 0.0.0.255 area 0

 

Configure OSPF on Router R2:

 

R2(config)#router ospf 2
R2(config-router)#network 192.168.6.0 0.0.0.255 area 0
R2(config-router)#network 192.168.4.0 0.0.0.255 area 0
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0

 

 

Configure OSPF on Router R3:

R3(config)#router ospf 3
R3(config-router)#network 192.168.5.0 0.0.0.255 area 0
R3(config-router)#network 192.168.3.0 0.0.0.255 area 0
R3(config-router)#network 192.168.4.0 0.0.0.255 area 0

 

Test Network communication:

First see the ip address of machine you are presently on using ipconfig command.
PC>ipconfig

FastEthernet0 Connection:(default port)

Link-local IPv6 Address………: FE80::230:A3FF:FE46:B74A
IP Address………………….: 192.168.5.2
Subnet Mask…………………: 255.255.255.0
Default Gateway……………..: 192.168.5.1

 

Test network connectivity:

PC>ping 192.168.1.2

Pinging 192.168.1.2 with 32 bytes of data:

Reply from 192.168.1.2: bytes=32 time=2ms TTL=126
Reply from 192.168.1.2: bytes=32 time=1ms TTL=126
Reply from 192.168.1.2: bytes=32 time=3ms TTL=126
Reply from 192.168.1.2: bytes=32 time=1ms TTL=126

Ping statistics for 192.168.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 3ms, Average = 1ms

 

Now if you want to trace the route of remotely located devices you can do that using tracert command.
PC>tracert 192.168.1.2

Tracing route to 192.168.1.2 over a maximum of 30 hops:

1 1 ms 0 ms 0 ms 192.168.5.1
2 0 ms 0 ms 17 ms 192.168.3.1
3 5 ms 12 ms 17 ms 192.168.1.2

Trace complete.

PC>tracert 192.168.6.2

Tracing route to 192.168.6.2 over a maximum of 30 hops:

1 0 ms 10 ms 0 ms 192.168.5.1
2 11 ms 1 ms 17 ms 192.168.4.1
3 13 ms 1 ms 4 ms 192.168.6.2

Trace complete.

 

 

PC>tracert 192.168.2.2

Tracing route to 192.168.2.2 over a maximum of 30 hops:

1 1 ms 0 ms 0 ms 192.168.5.1
2 0 ms 1 ms 11 ms 192.168.3.1
3 2 ms 2 ms 2 ms 192.168.2.2

Trace complete.

 

 

PC>tracert 192.168.2.1

Tracing route to 192.168.2.1 over a maximum of 30 hops:

1 1 ms 0 ms 0 ms 192.168.5.1
2 5 ms 1 ms 4 ms 192.168.2.1

Trace complete.

 

 

Now it’s time to learn few ospf Troubleshooting commands:

R2#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

Gateway of last resort is not set

O 192.168.1.0/24 [110/65] via 192.168.2.1, 00:09:12, Serial0/0/0
C 192.168.2.0/24 is directly connected, Serial0/0/0
O 192.168.3.0/24 [110/845] via 192.168.2.1, 00:07:57, Serial0/0/0
[110/845] via 192.168.4.2, 00:07:57, Serial0/0/1
C 192.168.4.0/24 is directly connected, Serial0/0/1
O 192.168.5.0/24 [110/782] via 192.168.4.2, 00:05:43, Serial0/0/1
C 192.168.6.0/24 is directly connected, FastEthernet0/0

 

Now lets see the routing table of OSPF:

R2#show ip route ospf
O 192.168.1.0 [110/65] via 192.168.2.1, 00:10:22, Serial0/0/0
O 192.168.3.0 [110/845] via 192.168.2.1, 00:09:07, Serial0/0/0
[110/845] via 192.168.4.2, 00:09:07, Serial0/0/1
O 192.168.5.0 [110/782] via 192.168.4.2, 00:06:53, Serial0/0/1

 

Now Lets see ospf neighbor details:

R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.1 0 FULL/ – 00:00:38 192.168.2.1 Serial0/0/0
192.168.5.2 0 FULL/ – 00:00:33 192.168.4.2 Serial0/0/1

 

Now see the protocols configured on your router.

R2#show ip protocols

Routing Protocol is “ospf 2”
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.6.1
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.6.0 0.0.0.255 area 0
192.168.4.0 0.0.0.255 area 0
192.168.2.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
192.168.3.1 110 00:11:05
192.168.5.2 110 00:07:30
192.168.6.1 110 00:09:46
Distance: (default is 110)

 

Lets explore little more detail about configured OSPF:

R2#show ip ospf
Routing Process “ospf 2” with ID 192.168.6.1
Supports only single TOS(TOS0) routes
Supports opaque LSA
It is an area border router
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 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 2. 2 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 0x013184
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0

 

See the ospf details on a specific interface:

R2#show ip ospf interface

FastEthernet0/0 is up, line protocol is up
Internet address is 192.168.6.1/24, Area 0
Process ID 2, Router ID 192.168.6.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 192.168.6.1, Interface address 192.168.6.1
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:03
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 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Serial0/0/1 is up, line protocol is up
Internet address is 192.168.4.1/24, Area 0
Process ID 2, Router ID 192.168.6.1, Network Type POINT-TO-POINT, Cost: 781
Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
No designated router on this network
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:09
Index 2/2, 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 192.168.5.2
Suppress hello for 0 neighbor(s)
Serial0/0/0 is up, line protocol is up
Internet address is 192.168.2.2/24, Area 0
Process ID 2, Router ID 192.168.6.1, Network Type POINT-TO-POINT, Cost: 64
Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
No designated router on this network
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:04
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 192.168.3.1
Suppress hello for 0 neighbor(s)

 

See OSPF database:

R2#show ip ospf database
OSPF Router with ID (192.168.6.1) (Process ID 2)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
192.168.3.1 192.168.3.1 823 0x80000005 0x0007f4 5
192.168.6.1 192.168.6.1 744 0x80000005 0x00523d 5
192.168.5.2 192.168.5.2 608 0x80000008 0x00d753 5

Router Link States (Area 1)

Link ID ADV Router Age Seq# Checksum Link count
192.168.6.1 192.168.6.1 840 0x80000007 0x005a23 0

Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.6.0 192.168.6.1 835 0x80000001 0x00631b
192.168.4.0 192.168.6.1 824 0x80000002 0x000b65
192.168.2.0 192.168.6.1 824 0x80000003 0x00043d
192.168.1.0 192.168.6.1 814 0x80000004 0x001729
192.168.3.0 192.168.6.1 814 0x80000005 0x00929b
192.168.5.0 192.168.6.1 607 0x80000009 0x00fb6b

 

See summary of ospf database:

R2#show ip ospf database summary

OSPF Router with ID (192.168.6.1) (Process ID 2)

Summary Net Link States (Area 1)

LS age: 872
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.6.0 (summary Network Number)
Advertising Router: 192.168.6.1
LS Seq Number: 80000001
Checksum: 0x631b
Length: 28
Network Mask: /24
TOS: 0 Metric: 1

LS age: 861
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.4.0 (summary Network Number)
Advertising Router: 192.168.6.1
LS Seq Number: 80000002
Checksum: 0x0b65
Length: 28
Network Mask: /24
TOS: 0 Metric: 781

LS age: 861
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.2.0 (summary Network Number)
Advertising Router: 192.168.6.1
LS Seq Number: 80000003
Checksum: 0x043d
Length: 28
Network Mask: /24
TOS: 0 Metric: 64

LS age: 851
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.1.0 (summary Network Number)
Advertising Router: 192.168.6.1
LS Seq Number: 80000004
Checksum: 0x1729
Length: 28
Network Mask: /24
TOS: 0 Metric: 65

LS age: 851
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.3.0 (summary Network Number)
Advertising Router: 192.168.6.1
LS Seq Number: 80000005
Checksum: 0x929b
Length: 28
Network Mask: /24
TOS: 0 Metric: 845

LS age: 644
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.5.0 (summary Network Number)
Advertising Router: 192.168.6.1
LS Seq Number: 80000009
Checksum: 0xfb6b
Length: 28
Network Mask: /24
TOS: 0 Metric: 782

 

 

R2#show ip ospf interface serial 0/0/0

Serial0/0/0 is up, line protocol is up
Internet address is 192.168.2.2/24, Area 0
Process ID 2, Router ID 192.168.6.1, Network Type POINT-TO-POINT, Cost: 64
Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
No designated router on this network
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:03
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 192.168.3.1
Suppress hello for 0 neighbor(s)

 

You can see the explanation of above ospf commands in below image:

ospf show commands

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s