Home ยป What is OSPF Protocol? How to implement it on enterprise networks?

What is OSPF Protocol? How to implement it on enterprise networks?

OSPF (Open Shortest Path First) is a routing protocol used in computer networks to exchange routing information among routers. It is an Interior Gateway Protocol (IGP) and is commonly used in large enterprise networks and service provider networks.

OSPF works by having routers send link-state advertisements (LSAs) to all other routers in the network. These LSAs contain information about the state of the router’s links and the network topology. Each router uses this information to build a complete map of the network, which it then uses to calculate the shortest path to all other routers.

OSPF uses a cost metric, which is calculated based on the bandwidth of the link. This metric is used to determine the shortest path to a destination network. OSPF can also be configured to take into account other factors, such as the reliability of a link, when calculating the shortest path.

One of the key advantages of OSPF is its ability to support variable-length subnet masks (VLSMs). This allows network administrators to use a single IP network address for multiple subnets of different sizes.

OSPF is a popular choice for large networks because it is efficient, scalable, and supports fast convergence times in the event of a network outage.

In the below example, we will implement OSPF routing protocol on our enterprise network system. Two different subnets will be able to talk to each other following OSPF routing protocol.

Start with Router 1 (R1) to Router 5 (R5). Configuration order is not important.

ROUTER – 1

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R1
R1(config)#int fa0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown

R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

R1(config-if)#do wr
Building configuration...
[OK]
R1(config-if)#exit
R1(config)#int se1/0
R1(config-if)#ip address 192.168.10.2 255.255.255.0
R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial1/0, changed state to down
R1(config-if)#do wr
Building configuration...
[OK]
R1(config-if)#exit
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.10.0 0.0.0.255 area 0
R1(config-router)#do wr
Building configuration...
[OK]
R1(config-router)#exit
R1(config)#

ROUTER-2

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R2
R2(config)#int se1/2
R2(config-if)#ip address 192.168.10.1 255.255.255.0
R2(config-if)#no shutdown

R2(config-if)#
%LINK-5-CHANGED: Interface Serial1/2, changed state to up

R2(config-if)#exit
R2(config)#int se
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up
1/1
R2(config-if)#ip address 11.0.0.0
% Incomplete command.
R2(config-if)#ip address 11.0.0.1 255.0.0.0
R2(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial1/1, changed state to down
R2(config-if)#exit
R2(config)#int se1/0
R2(config-if)#ip address 10.0.0.1 255.0.0.0
R2(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial1/0, changed state to down
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#network 192.168.10.0 0.0.0.255 area 0
R2(config-router)#n
00:01:57: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.10.2 on Serial1/2 from LOADING to FULL, Loading Done
R2(config-router)#network 11.0.0.0 0.255.255.255 area 0
R2(config-router)#network 10.0.0.0 0.255.255.255 area 0
R2(config-router)#do wr
Building configuration...
[OK]
R2(config-router)#exit
R2(config)#

ROUTER-3

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R3
R3(config)#int se1/1
R3(config-if)#ip address 11.0.0.2 255.0.0.0
R3(config-if)#no shutdown

R3(config-if)#
%LINK-5-CHANGED: Interface Serial1/1, changed state to up

R3(config-if)#exit
R3(config)#int se1/0
R3(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up

R3(config-if)#ip address 12.0.0.2 255.0.0.0
R3(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial1/0, changed state to down
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 11.0.0.0 0.255.255.255 area 0
R3(config-router)#net
00:01:54: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.10.1 on Serial1/1 from LOADING to FULL, Loading Done
work 12.0.0.0 0.255.255.255 area 0
R3(config-router)#do wr
Building configuration...
[OK]
R3(config-router)#exit
R3(config)#

ROUTER – 4

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int se1/0
Router(config-if)#ip address 10.0.0.2 255.0.0.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/0, changed state to up

Router(config-if)#exit
Router(config)#int se1/2
Router(config-if)#no shutdown
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
Router(config-if)#ip address 192.168.20.1 255.255.255.0
Router(config-if)#exit
Router(config)#int se1/1
Router(config-if)#ip address 12.0.0.1 255.0.0.0
Router(config-if)#no shutdown

Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/1, changed state to up

Router(config-if)#exit
Router(config)#do wr
Building configuration...
[OK]
Router(config)#router o
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state
% Incomplete command.
Router(config)#router ospf 1
Router(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router(config-router)#network 
00:02:05: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.10.1 on Serial1/0 from LOADING to FULL, Loading Done

% Incomplete command.
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#network 1
00:02:23: %OSPF-5-ADJCHG: Process 1, Nbr 12.0.0.2 on Serial1/1 from LOADING to FULL, Loading Done
% Incomplete command.
Router(config-router)#network 192.168.20.0 0.0.0.255 area 0
Router(config-router)#do wr
Building configuration...
[OK]
Router(config-router)#exit
Router(config)#

ROUTER – 5

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R5
R5(config)#int se1/0
R5(config-if)#ip address 192.168.20.2 255.255.255.0
R5(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial1/0, changed state to down
R5(config-if)#exit
R5(config)#int fa0/0
R5(config-if)#ip address 192.168.2.1 255.255.255.0
R5(config-if)#no shutdown

R5(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

R5(config-if)#do wr
Building configuration...
[OK]
R5(config-if)#exit
R5(config)#router ospf 1
R5(config-router)#network 192.168.20.0 0.0.0.255 area 0
R5(config-router)#network 192.168.2.0 0.0.0.255 area 0
R5(config-router)#do wr
Building configuration...
[OK]
R5(config-router)#exit
R5(config)#exit
R5#
%SYS-5-CONFIG_I: Configured from console by console

R5#copy runn
R5#copy running-config start
R5#copy running-config startup-config 
Destination filename [startup-config]? 
Building configuration...
[OK]

ROUTER – 1 // IP ROUTE TABLE

R1#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    10.0.0.0/8 [110/128] via 192.168.10.1, 00:10:26, Serial1/0
O    11.0.0.0/8 [110/128] via 192.168.10.1, 00:13:08, Serial1/0
O    12.0.0.0/8 [110/192] via 192.168.10.1, 00:09:48, Serial1/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.10.0/24 is directly connected, Serial1/0
O    192.168.20.0/24 [110/192] via 192.168.10.1, 00:01:59, Serial1/0

R1#

ROUTER – 2 // IP ROUTE TABLE

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

C    10.0.0.0/8 is directly connected, Serial1/0
C    11.0.0.0/8 is directly connected, Serial1/1
O    12.0.0.0/8 [110/128] via 11.0.0.2, 00:10:35, Serial1/1
                [110/128] via 10.0.0.2, 00:10:35, Serial1/0
O    192.168.1.0/24 [110/65] via 192.168.10.2, 00:02:45, Serial1/2
C    192.168.10.0/24 is directly connected, Serial1/2
O    192.168.20.0/24 [110/128] via 10.0.0.2, 00:03:37, Serial1/0

R2#

ROUTER – 3 // IP ROUTE TABLE

R3#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    10.0.0.0/8 [110/128] via 11.0.0.1, 00:11:39, Serial1/1
                [110/128] via 12.0.0.1, 00:11:39, Serial1/0
C    11.0.0.0/8 is directly connected, Serial1/1
C    12.0.0.0/8 is directly connected, Serial1/0
O    192.168.1.0/24 [110/129] via 11.0.0.1, 00:03:49, Serial1/1
O    192.168.10.0/24 [110/128] via 11.0.0.1, 00:14:49, Serial1/1
O    192.168.20.0/24 [110/128] via 12.0.0.1, 00:04:41, Serial1/0

R3#

ROUTER – 4 // IP ROUTE TABLE

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

C    10.0.0.0/8 is directly connected, Serial1/0
O    11.0.0.0/8 [110/128] via 10.0.0.1, 00:13:03, Serial1/0
                [110/128] via 12.0.0.2, 00:13:03, Serial1/1
C    12.0.0.0/8 is directly connected, Serial1/1
O    192.168.1.0/24 [110/129] via 10.0.0.1, 00:05:13, Serial1/0
O    192.168.10.0/24 [110/128] via 10.0.0.1, 00:13:21, Serial1/0
C    192.168.20.0/24 is directly connected, Serial1/2

R4#

ROUTER – 5 // IP ROUTE TABLE

R5#sh 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    10.0.0.0/8 [110/128] via 192.168.20.1, 00:01:44, Serial1/0
O    11.0.0.0/8 [110/192] via 192.168.20.1, 00:01:44, Serial1/0
O    12.0.0.0/8 [110/128] via 192.168.20.1, 00:01:44, Serial1/0
O    192.168.1.0/24 [110/193] via 192.168.20.1, 00:01:44, Serial1/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
O    192.168.10.0/24 [110/192] via 192.168.20.1, 00:01:44, Serial1/0
C    192.168.20.0/24 is directly connected, Serial1/0

R2>enable
R2#show ip protocols

Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set 
  Incoming update filter list for all interfaces is not set 
  Router ID 192.168.10.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.10.0 0.0.0.255 area 0
    11.0.0.0 0.255.255.255 area 0
    10.0.0.0 0.255.255.255 area 0
  Routing Information Sources:  
    Gateway         Distance      Last Update 
    12.0.0.1             110      00:11:57
    12.0.0.2             110      00:01:39
    192.168.10.1         110      00:01:57
    192.168.10.2         110      00:23:52
    192.168.20.2         110      00:11:57
  Distance: (default is 110)

R2#

#########################################################

R1>router ospf <1-65535> Process ID (choose between these values but supposed to be the same with other routers)

R1>network <ip> <wildcard mask> area <value> (<0-4294967295> OSPF area ID as a decimal value)

#########################################################

Please feel free to contact if you need any assistance ๐Ÿ™‚ Happy networking !

Related Posts

error: Content is protected !!