OSPF Open Shortest Path First
OSPF (Open Shortest Path First) is most popular link state routing protocol. Open Shortest Path First (OSPF) is an open standard (not proprietary) and it will run on most different vendors router, where else EIGRP is a Cisco proprietary protocol that can be run only on Cisco devices.Open Shortest Path First (OSPF) uses the Shortest Path First (SPF) algorithm, developed by Dijkstra, to provide a loop-free topology.
OSPF is classless Protocle and it supports VLSM and equal cost load balancing.
Default administrative distance for OSFP routes is 110.
Disadvantages of Open Shortest Path First (OSPF)
a) Requires more memory for storing information of adjacency , topology , and routing tables.
b) Requires more CPU processing to run the SPF algorithm.
c) Complex routing protocol.
OSPF have three table for storing routing and topology information
neighbor table – Have a list of all neighboring routers.
topology table – Have a list of all possible routers to all knows networks within an area.
routing table – Have the best route for each known network.
Hello packet communicate in every 10 second on network,if router does not receive any single hello packet for 40 second then it declare neighbor network is down.
Some Terminology used in Open Shortest Path First (OSPF)
Router ID
Each OSPf router is identified by a unique Router ID.
Router ID can be manually specified.
If not manually configured then the highest IP address configured on any loopbac kinterface on the router will become the Router ID.
If no loopback interface exists, the highest IP address configured on any physical interface will become the Router ID.
Loopback interfaces are physical interfaces on a router .
Internal Routers – In which all of their interfaces connect to a single OSPF area
Backbone Routers – In which at least one interface connected to backbone area
Designated Router (DR) and Backup Designated Router (BDR)
OSPF chose one router as designated router (DR) and another router as backup designated router (BDR). It follow rule to chose between DR and BDR.
- For DR it must have highest OSPF priority,By default all router have 1 priority.
2. It its tie then router with highest router ID will be selected.
OSPF areas
OSPF area is a sub-domain of OSPF network.
1) router in the backbone area(area 0) are called backbone routers.
2) Routers between 2 areas ( area 0 or area 1) are called as Area border routers(ABR)
3) Router that run OSPF and are connected to another network that runs another routing protocol ( for example EIGRP) are called Autonomous System border routers (ASBR)
From the Above diagram RouterA is an ABR (Area Border Router) because it interfaces is in two area that is area 0 and area 1.
RouterB is an ASBR (Autonomous System Border Routers) because it connected to another routing domain that is EIGRP domain router.
Link-state advertisement (LSA)
To exchange topology information router uses LSA. An LSA contains routing and topology information that describe a part of an OSPF network
OSPF LSA Types
Type 1 Represent a router
Type 2 Represent the pseudo node(designated router) for a multi access line
Type 3 A network link summary(internal route)
Type 4 Represent an ASBR
Type 5 A route external to the OSPF domain
Type 7 used in stub areas in place of a type 5 LSA
Open Shortest Path First (OSPF) Protocol
considering we have configure Hostname and IP address in Router01,Router03,Router03
Please refer how to configure Hostname and IP address in Router01,Router03,Router03 by clicking here.
Open Shortest Path First (OSPF) Protocol configuration in Router01
Router01>enable Router01#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router01(config)#router ospf 1 Router01(config-router)#network 172.16.0.0 0.0.255.255 area 0 Router01(config-router)#network 172.17.0.0 0.0.255.255 area 0 Router01(config-router)#exit Router01(config)#exit Router01#
Open Shortest Path First (OSPF) Protocol configuration in Router02
Router02> Router02>enable Router02#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router02(config)#router ospf 1 Router02(config-router)#network 172.17.0.0 0.0.255.255 area 0 Router02(config-router)#network 172.18.0.0 0.0.255.255 area 0 Router02(config-router)#network 172.19.0.0 0.0.255.255 area 0 Router02(config-router)#exit Router02(config)#exit
Open Shortest Path First (OSPF) Protocol configuration in Router03
Router03>enable Router03#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router03(config)#router ospf 1 Router03(config-router)#network 172.19.0.0 0.0.255.255 area 0 Router03(config-router)#network 172.20.0.0 0.0.255.255 area 0 Router03(config-router)#exit Router03(config)#exit Router03#
How to view the routing table in Router01
Router01>enable Router01#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 172.16.0.0/16 is directly connected, FastEthernet0/0 C 172.17.0.0/16 is directly connected, Serial0/0 O 172.18.0.0/16 [110/65] via 172.17.0.2, 00:26:31, Serial0/0 O 172.19.0.0/16 [110/128] via 172.17.0.2, 00:26:21, Serial0/0 O 172.20.0.0/16 [110/129] via 172.17.0.2, 00:24:54, Serial0/0
How to view the routing table in Router02
Router02>enable Router02#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 172.16.0.0/16 [110/65] via 172.17.0.1, 00:30:20, Serial0/0 C 172.17.0.0/16 is directly connected, Serial0/0 C 172.18.0.0/16 is directly connected, FastEthernet0/0 C 172.19.0.0/16 is directly connected, Serial0/1 O 172.20.0.0/16 [110/65] via 172.19.0.2, 00:28:08, Serial0/1
How to view the routing table in Router03
Router03>enable Router03#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 172.16.0.0/16 [110/129] via 172.19.0.1, 00:29:43, Serial0/1 O 172.17.0.0/16 [110/128] via 172.19.0.1, 00:29:43, Serial0/1 O 172.18.0.0/16 [110/65] via 172.19.0.1, 00:29:43, Serial0/1 C 172.19.0.0/16 is directly connected, Serial0/1 C 172.20.0.0/16 is directly connected, FastEthernet0/0
Verify the connectivity between networks using the ping command
To verify the Open Shortest Path First (OSPF) Protocol routes and the connectivity between networks, run the ping command from Host01 (IP address: 172.16.0.10/16) to Host03 (IP address: 172.20.0.10/16).
C:\>ping 172.20.0.10 Pinging 172.20.0.10 with 32 bytes of data: Reply from 172.20.0.10: bytes=32 time=172ms TTL=125 Reply from 172.20.0.10: bytes=32 time=188ms TTL=125 Reply from 172.20.0.10: bytes=32 time=157ms TTL=125 Reply from 172.20.0.10: bytes=32 time=188ms TTL=125 Ping statistics for 172.20.0.10: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 157ms, Maximum = 188ms, Average = 176ms
The ping reply from Host03 (IP address: 172.20.0.10/16) shows that the Open Shortest Path First (OSPF) Protocol is configured well in three routers and there is network connectivity between different networks.