This module describes how to configure Open Shortest Path First (OSPF). OSPF is an Interior Gateway Protocol (IGP). OSPF was designed expressly for IP networks and it supports IP subnetting and tagging of externally derived routing information. OSPF also allows packet authentication and uses IP multicast when sending and receiving packets.
Cisco OSPF Implementation:
The Cisco implementation conforms to the OSPF Version 2 specifications detailed in the Internet RFC 2328.
- Stub areas—The definition of stub areas is supported.
- Authentication—Plain text and message-digest algorithm 5 (MD5) authentication among neighboring routers within an area is supported.
- Routing interface parameters—Configurable parameters supported include interface output cost, retransmission interval, interface transmit delay, router priority, router “dead” and hello intervals, and authentication key.
- Virtual links—Virtual links are supported.
- Not-so-stubby area (NSSA)—RFC 3101, which replaces and is backward compatible with RFC 1587.
- OSPF over demand circuit—RFC 1793.
Let’s us configure a simple network to understand how the OSPF work.
Task 1: Prepare the network according to your need or similar to the one in the network diagram:
- Firstly, let’s configure the Router with the help of command
Router>enable Router# configure terminal Router(config-if)# hostname R1 R1(config-if)# interface fa0/0 R1(config-if)#ip address 172.16.1.17 255.255.255.240 R1(config-if)#no shutdown R1(config-if)#exit
R1 - Interface serial 2/0
R1(config)# interface serial2/0 R1(config-if)#ip address 192.168.10.1 255.255.255.252 R1(config-if)#clock rate 64000 R1(config-if)#no shutdown R1(config-if)#exit
R1 - Interface serial 3/0
R1(config)# interface serial3/0 R1(config-if)#ip address 192.168.10.5 255.255.255.252 R1(config-if)#clock rate 64000 R1(config-if)#no shutdown R1(config-if)#exit
Likewise configure on R2 & R3
Interface fa0/0 10.10.10.1 subnet 255.255.255.0 Interface serial2/0 192.168.10.2 subnet 255.255.255.252 Interface serial 3/0 192.168.10.9 subnet 255.255.255.252
Interface fa0/0 172.16.1.33 subnet 255.255.255.248 Interface serial2/0 192.168.10.6 subnet 255.255.255.252 Interface serial 3/0 192.168.10.10 subnet 255.255.255.252
Now, configure PCs:
Ip address 10.10.10.10 Subnet mask 255.255.255.0 Default gateway 10.10.10.1
Ip address 172.16.1.35 Subnet mask 255.255.255.248 Default gateway 172.16.1.33
Task 2: verify ip addressing and interfaces.
- Use the “show ip interface brief” command to verify that the IP addressing is correct and that the interfaces are active. And ping on every system.
Task 3: configure OSPF on the R1
Use the command to configure OSPF on router:
R1(config)#router ospf 1 R1(config-router)#
- Once you are in the Router OSPF configuration sub-mode, configure the LAN network 172.16.1.16/28 to be included in the OSPF updates that are sent out of R1.
R1(config-router)#network 172.16.1.16 0.0.0.15 area 0 R1(config-router)#
- Configure the router to advertise the 192.168.10.0/30 network attached to the Serial2/0 interface.
R1(config-router)# network 192.168.10.0 0.0.0.3 area 0 R1(config-router)#
- Configure the router to advertise the 192.168.10.4/30 network attached to the Serial3/0 interface.
R1(config-router)# network 192.168.10.4 0.0.0.3 area 0 R1(config-router)# R1(config-router)#end
- When you are finished with the OSPF configuration for R1, return to privileged EXEC mode.
Task 4: configure OSPF on the R2 & R3.
- when the network for the serial link from R1 to R2 is added to the OSPF configuration, the router sends a notification message to the console stating that a neighbor relationship with another OSPF router has been established.
R2(config-router)#network 192.168.10.8 0.0.0.3 area 0 R2(config-router)#end
- Again, notice that when the networks for the serial links from R3 to R1 and R3 to R2 are added to the OSPF configuration, the router sends a notification message to the console stating that a neighbor relationship with another OSPF router has been established.
Task 5: configure OSPF router IDs.
- The OSPF router ID is used to uniquely identify the router in the OSPF routing domain. A router ID is an IP address.
To check the router ID use the command called “show ip protocols”.
R3#show ip protocols
R3#show ip osp
R3#show ip ospf interface
- Use loopback addresses to change the router IDs of the routers in the topology.
R1(config)#interface loopback 0 R1(config-if)#ip address 10.1.1.1 255.255.255.255 R2(config)#interface loopback 0 R2(config-if)#ip address 10.2.2.2 255.255.255.255 R3(config)#interface loopback 0 R3(config-if)#ip address 10.3.3.3 255.255.255.255
- Use the show” ip ospf neighbors” command to verify that the router IDs have changed. Your output may be different because output depend on the router that we are using.
- Use the router-id command to change the router ID on the R1 router but Some IOS versions do not support the router-id command. If this command is not available, continue to Task 6.
R1#(config-router)#end R1# clear ip ospf process Reset ALL OSPF processes? [no]:yes R1#
- Use the “show ip ospf neighbor” command on router R2 to verify that the router ID of R1 has been changed.
Task 6: verify OSPF operation.
- On the R1 router, Use the “show ip ospf neighbor” command to view the information about the OSPF neighbor routers R2 and R3.
- On the R1 router, use the “show ip protocols” command to view information about the routing protocol operation. Notice that the output specifies the process ID used by OSPF.
Task 7: Examine OSPF Routes in the Routing Tables
- View the routing table on the R1 router. OSPF routes are denoted in the routing table with an “O”.
Task 8: configure OSPF Cost:
- Use the “show ip route” command on the R1 router to view the OSPF cost to reach the 10.10.10.0/24 network.
- Use the show interfaces serial2/0 command on the R1 router to view the bandwidth of the Serial2/0 interface.
- Use the bandwidth command to change the bandwidth of the serial interfaces of the R1 and R2 routers to the actual bandwidth, 64 kbps.
R1(config)#interface serial2/0 R1(config-if)#bandwidth 64 R1(config-if)#interface serial3/0 R1(config-if)#bandwidth 64
R2(config)#interface serial2/0 R2(config-if)#bandwidth 64 R2(config)#interface serial3/0 R2(config-if)#bandwidth 64
- Use the “show ip ospf interface” command on the R1 router to verify the cost of the serial links.
Task 9: Redistribute an OSPF Default Route
- Use the default-information originate command to include the static route in the OSPF updates that are sent from the R1 router.
- View the routing table on the R2 router to verify that the static default route is being redistributed via OSPF.
R2#show ip route
- Examine the routing table on the R1 router to verify the change in the OSPF cost metric. Notice that the values are much larger cost values for OSPF routes.
R1#show ip route
Configure the OSPF Hello and Dead intervals.
- The OSPF Hello and Dead intervals can be modified manually using the” ip ospf hellointerval” and “ip ospf dead-interval” interface commands. Use these commands to change the hello interval to 5 seconds and the dead interval to 20 seconds on the Serial2/0 interface of the R1 router.
R1(config)#interface serial2/0 R1(config-if)#ip ospf hello-interval 5 R1(config-if)#ip ospf dead-interval 20 R1(config-if)#
Modify the Dead Timer and Hello Timer intervals.
- Modify the Dead Timer and Hello Timer intervals on the Serial 0/0/0 interface in the R2 router to match the intervals configured on the Serial2/0 interface of the R1 router.
- Use the “show ip ospf interface serial2/0” command to verify that the Hello Timer and Dead Timer intervals have been modified.
Try to implement this in your Packet Tracer, get it from here