Mikkel Damgaard

Skip to main content
< All Topics
Print

What is OSPF and how does it work?

OSPF is a dynamic routing protocol used in many networks. The benefits of using a dynamic routing protocol lays in the name. A dynamic routing protocol will update the routing table based on updates in the network, if you fx add new routes or if a router breakes down. 

How does OSPF work?

OSPF is based on a neighbor system where neighbors exchange routes wuth eachother, in OSPF setup you generally want to have a convergence network, which means every router knows every networks/subnets there might be. That is becouse every router in the network builds its own database also called a routing tree. Based on the routers own OSPF database the router will decide the best route for the destination, therefore missing information about the network could lead to routers taking bad routing decissions.

OSPF i dynamic which means it will account for a link going down, it will detect that and it will select a new shortest path to forward packets to.

Its using a cost system to calulate the routes which is based on bandwith speed. The route with the lowest cost will be the route used by the router. 

Every router in the OSPF network will create its own routing tree with its own prefered paths to networks. This calculation procces will happen every time you change network settigns in the network, therefore in large networks with a lot of routers its recomended to use multple areas. This decreses the size of the routers OSPF database as it only has to calculate routes in its own area. 

Metric system

OSPF is based on the metric system bandwith, which means cost is calculated based on links negociated bandwith. Its the cost of the route that determs where the packets is sent. OSPF Sends the packets to the route with the lowest cost. 
OBS: If OSPF has multiple routes to the same distination with the same cost it will load balance between the routs by default. 

Becouse OSPF is an old protocol its designed for older networking devices that cannot follow todays badnwith speed. Therefore a feature has been added which allows you to override the default cost values.
See default OSPF cost bandwiths and their costs below. 

Bandwith OSPF Cost
10 Gbps
1
1 Gbps
1
100 Mbps
1
10 Mbps
10
1544 Mbps
64
768 Kbps
133
384 Kbps
266
128 Kbps
781

How does OSPF neighbors work?

OSPF works by discovering neighbors, it discovers neighbors with the use of hello packets if another router has OPSF configured and recives it, it will send a hello packet back and the router and they will become neighbors. After the routers becomes neigbors they will forward packets to each other with their routes and obtain its neighbors routes. The router will use this information to build its OSPF database. 

OSPF neighbors will always forward hello packets to each other but will only exchange routes if relevent, if fx one of the routers announces a new network.

BEST PRACTICE

  • Loopback Interfaces: Its highly recomended to use loopback interfaces as your OSPF Router ID. It simplifies troubleshooting as its easier to get a overview of the ospf neighbors.
  • Update the OSPF Costs: To ensure you network performs to your exspectations, update the cost system to match your bandwith standards. 
Tags:
Table of Contents

Leave a Reply

Your email address will not be published. Required fields are marked *