OSPF
OSPF
Characteristic:
OSPF is a link-state routing protocol used in IP networks.
OSPF uses Dijkstra's Algorithm (SPF) it is shortest path first (SPF) algorithm, that is used to find
the best path between the source and the destination router using its own shortest path first.
A link-state routing protocol
It sends triggered updates (i.e., if there is a change observed in the learned routing table then
the updates are triggered only, not like the distance-vector routing protocol where the routing
table is exchanged at a period of time.)
It is a network layer protocol that works on protocol number 89
AD value is 110.
OSPF uses multicast address 224.0.0.5 for normal communication and 224.0.0.6 for updating to
the designated router (DR)/Backup Designated Router (BDR).
Example: Google Maps
OSPF messages –
OSPF uses certain messages for the communication between the routers operating OSPF.
Hello message –
These are keep-alive messages used for neighbor discovery /recovery. These are exchanged
every 10 seconds. This includes the following information: Router I’d, Hello/dead interval, Area
I’d, Router priority, DR and BDR IP address, authentication data.
Note – Link State Advertisement and Link State Acknowledgement both are different messages.
Criteria:
It should be present in the same area.
The router I’d be unique.
The subnet mask should be the same.
Hello, and the dead timer should be the same.
The stub flag must match.
Authentication must match
Cost Calculation
Cost= Reference Bandwidth / Link Bandwidth-By default, the Reference Bandwidth is 100 Mbps. The
Link Bandwidth is the actual bandwidth of the interface (in bits per second)
Example:
o For a 100 Mbps link: Cost=100/100=1
o For a 10 Mbps link: Cost=100/10=10
OSPF Areas
1. Area 0 (Backbone Area): Central area to which all other areas connect.
2. Stub Area: Blocks external routes
3. NSSA (Not-So-Stubby Area): Allows limited external routes.
4. Totally Stubby Area: Most restrictive, only default route allowed.
OSPF Router Types
Internal Router : All interfaces in the same area.
Backbone Router : Belongs to Area S0.
Area Border Router (ABR) : Connects different areas.
Autonomous System Boundary Router (ASBR): Redistributes routes from external
sources into OSPF.
DR and BDR
DR (Designated Router): acting as the central point for updates in a multi-access network. it’s
like team leader
BDR (Backup Designated Router): Takes over if the DR fails.
OSPF Timers
Hello Interval: (default: 10 seconds).
Dead Interval: (default: 40 seconds).
Configuration Commands
#router ospf [process-id] – Enable OSPF process
#router-id [A.B.C.D] – Assign router ID
#network [network-address] [wildcard-mask] area [area-id] – Add network to OSPF
Interface Commands
#ip ospf [process-id] area [area-id] – Activate OSPF on an interface
#ip ospf cost [cost] – Set OSPF interface cost
#ip ospf hello-interval [seconds] – Set hello interval
#ip ospf dead-interval [seconds] – Set dead interval
Route Summarization
#area [area-id] range [network-address] [subnet-mask]
Verification Commands
#show ip ospf – Display OSPF configuration
#show ip ospf neighbor – Display neighbors
#show ip ospf interface [interface-id] – Display OSPF interfaces
#show ip ospf database – Display OSPF database
#show ip route ospf – Display OSPF routes
Troubleshooting Commands
#clear ip ospf process – Restart OSPF
#debug ip ospf [options] – Debug OSPF