Routing OSPF Configuration with Cisco Packet Tracer
OSPF (Open Shortest Path First)
OSPF (Open Shortest Path First) is an open standard link-state routing protocol (non-proprietary based) that a large number of network vendors have implemented. When connecting to a non-proprietary network, there are only two options: RIP and OSPF. If the destination network is large enough, then OSPF is the only choice.
Reasons for creating OSPF:
1. To reduce overhead (processing time) routing.
2. To speed up convergence.
3. To limit network instability in an area of the network only.
Routing OSPF Configuration
Here are the steps to configure OSPF with one of the examples.
1. Create a topology shape like the following image.
Description: The cable used to connect the router to the router is serial DTE, while to connect the router to a PC uses a Cooper Cross-Over cable.
The following table addresses the IP Address to make it clear more.
After understanding the addressing table above, then enter the configuration.
The first step is to first configure the IP for the router, which will also be used as a gateway
2. Router 0 configuration via CLI
Click on Router 0 >> CLI >> then configure it as follows.
Would you like to enter the initial configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ex
Router(config)#int se2/0
Router(config-if)#ip add 192.168.4.1 255.255.255.0
Router(config-if)#no sh
%LINK-5-CHANGED: Interface Serial2/0, changed state to down
Router(config-if)#
3. Router 1 configuration via CLI
Would you like to enter the initial configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ex
Router(config)#int se2/0
Router(config-if)#ip add 192.168.4.2 255.255.255.0
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
Router(config-if)#ex
Router(config)#int se3/0
Router(config-if)#ip add 192.168.5.1 255.255.255.0
Router(config-if)#no sh
%LINK-5-CHANGED: Interface Serial3/0, changed state to down
Router(config-if)#
4. Router 2 configuration via CLI
Would you like to enter the initial configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip add 192.168.3.1 255.255.255.0
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ex
Router(config)#int se2/0
Router(config-if)#ip add 192.168.5.2 255.255.255.0
Router(config-if)#no sh
Router(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
Router(config-if)#
5. Commands for OSPF routing configuration
- ROUTER 0
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#router-id 2.2.2.2
Router(config-router)#net 192.168.1.0 0.0.0.255 area 1
Router(config-router)#net 192.168.4.0 0.0.0.255 area 1
Router(config-router)#log-ad
Router(config-router)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
- ROUTER 1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#net 192.168.2.0 0.0.0.255 area 1
Router(config-router)#net 192.168.4.0 0.0.0.255 area 1
Router(config-router)#net 192.168.5.0 0.0.0.255 area 1
Router(config-router)#log-ad
Router(config-router)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
- ROUTER 2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#net 192.168.3.0 0.0.0.255 area 1
Router(config-router)#net 192.168.5.0 0.0.0.255 area 1
Router(config-router)#
00:39:15: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.5.1 on Serial2/0 from LOADING to FULL, Loading Done
Router(config-router)#log-ad
Router(config-router)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
6. The last step to test it, try to test ping from every PC 1 to PC 2
Cisco Packet Tracer PC Command Line 1.0
C:\>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Request timed out.
Reply from 192.168.2.2: bytes=32 time=1ms TTL=126
Reply from 192.168.2.2: bytes=32 time=10ms TTL=126
Reply from 192.168.2.2: bytes=32 time=21ms TTL=126
Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 21ms, Average = 10ms
C:\>ping 192.168.3.2
Pinging 192.168.3.2 with 32 bytes of data:
Request timed out.
Reply from 192.168.3.2: bytes=32 time=11ms TTL=125
Reply from 192.168.3.2: bytes=32 time=11ms TTL=125
Reply from 192.168.3.2: bytes=32 time=12ms TTL=125
Ping statistics for 192.168.3.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 11ms, Maximum = 12ms, Average = 11ms
or ping using “add simple PDU(P)”