Open Shortest Path First

Krithika Sharma
Geek Culture
Published in
8 min readAug 4, 2021

--

OSPF (Open Shortest Path First)

OSPF is a standardized Link-State routing protocol, designed to scale efficiently to support larger networks.

OSPF Characteristics

  • OSPF employs a hierarchical network design using Areas.
  • OSPF will form neighbor relationships with adjacent routers in the same Area.
  • Instead of advertising the distance to connected networks, OSPF advertises the status of directly connected links using Link-State Advertisements (LSAs).
  • OSPF sends triggered updates only and send only changes
  • LSAs are additionally refreshed every 30 minutes.
  • OSPF traffic is multicast either to address 224.0.0.5 (all OSPF routers) or 224.0.0.6 (all Designated Routers).
  • Point to Point only uses multicast address 224.0.0.5
  • OSPF uses the Dijkstra Shortest Path First algorithm to determine the shortest path.
  • OSPF is a classless protocol, and thus supports VLSMs.
  • OSPF supports only IP routing.
  • OSPF routes have an administrative distance is 110.
  • OSPF uses cost as its metric, which is computed based on the bandwidth of the link.
  • OSPF COST = Reference bandwidth/Link Bandwidth
  • OSPF has no hop-count limit.
  • OSPF forms neighbor relationships, called adjacencies, with other routers in the same Area.
  • All routers must be connected to area 0 (Backbone Area)
  • All Routers in an AREA have the same topology table
  • OSPF summarise networks in ABR (Area Border Router)
  • One Area contains localized updates.
  • ASBR (Autonomous System Border Router) Connects OSPF with other dynamic protocols like EIGRP OR RIP
  • only ABR and ASBR can summarize in OSPF
  • OSPF only become a neighbor with routers in the same area
  • In every single network in OSPF having a shared segment, there will be a DR and BDR
  • In a shared Ethernet segment ,Only DR and BDR will be in FULL state and others might be in 2 Way state

The OSPF process builds and maintains three separate tables:

  • A neighbor table — contains a list of all neighboring routers.
  • A topology table — contains a list of all possible routes to all known networks within an area.
  • A routing table — contains the best route for each known network.

Different types of routers in OSPF

  • Routers in the backbone area (area 0) are called backbone routers.
  • Routers between 2 areas (like the one between area 0 and area 1) are called area border routers (ABR)
  • Routers that run OSPF and are connected to another network that runs another routing protocol (for example RIP) are called autonomous system border routers ( ASBR)

Each OSPF router is identified by a unique Router ID. The Router ID can be determined in one of three ways:

  • The Router ID can be manually specified.
  • If not manually specified, the highest IP address configured on any Loopback interface 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

Hello / Dead Interval

  • OSPF hello/Dead Interval time for non-broadcast and point-to-multipoint interfaces. : 30/120 seconds
  • OSPF hello/Dead Interval time for broadcast and point-to-point interfaces. : 10/40 seconds
  • Notice that, by default, the dead interval timer is four times the Hello interval.

DR and BDR election

  • First they look at Router Priority. BY Default Router priority is One.We can change it if we need
  • If Router priority is the same, OSPF will look at Highest Router -ID for DR BDR election
  • If we set Router priority as O, that router will not participate in DR/BDR election
  • In FrameRelay (NBMA -non broadcast multi access) network ,HUB Must be elected as DR .We can do this by changing router priority

OSPF LSA Types

  • Type 1 — Represents a router
  • Type 2 — Represents the pseudonode (designated router) for a multiaccess link
  • Type 3 — A network link summary (internal route)
  • Type 4 — Represents an ASBR
  • Type 5 — A route external to the OSPF domain
  • Type 7 — Used in stub areas in place of a type 5 LSA

OSPF Area types

  • Backbone area (area 0)
  • Standard area
  • Stub area
  • Totally stubby area
  • Not-so-stubby area (NSSA)

OSPF Network Types

  1. Point-to-Point — indicates a topology where two routers are directly connected.

• No DRs and BDRs.

• All OSPF traffic is multicast to 224.0.0.5.

• Neighbors do not need to be manually specified.

2. Point-to-Multipoint — indicates a topology where one interface can connect to multiple destinations. Each connection between a source and destination is treated as a point-to-point link.

• OSPF will not elect DRs and BDRs.

• All OSPF traffic is multicast to 224.0.0.5.

• Neighbors do not need to be manually specified.

3. Broadcast Multi-Access — indicates a topology where broadcast occurs.

• OSPF will elect DRs and BDRs.

• Traffic to DRs and BDRs is multicast to 224.0.0.6. Traffic from DRs and BDRs to other routers is multicast to 224.0.0.5.

• Neighbors do not need to be manually specified.

• Examples Ethernet

4. Non-Broadcast

5. Non-broadcast Multi-access Network (NBMA) — indicates a topology where one interface can connect to multiple destinations; however, broadcasts cannot be sent across an NBMA network.

• An example would be Frame Relay.

• OSPF will elect DRs and BDRs.

• OSPF neighbors must be manually defined, thus All OSPF traffic is unicast instead of multicast.

  • Remember: On non-broadcast networks, neighbors must be manually specified, as multicast Hello’s are not allowed.

OSPF DR and BDR election

OSPF elects a Designated Router (DR) for each multi-access network, accessed via multicast address 224.0.0.6. For redundancy purposes, a Backup Designated Router (BDR) is also elected.

DR and BDR election

  • The router with the highest priority becomes the DR; the second highest becomes the BDR. If there is a tie-in priority, Whichever router has the highest Router ID will become the DR.
  • By default, router priority will be the same. We can change it if we need it
  • Default priority on Cisco routers is 1.If we set Router priority as O, that router will not participate in DR/BDR election
  • In FrameRelay (NBMA -nonbroadcast multi-access) network, HUB Must be elected as DR . We can do this by changing router priority

To change the priority on an interface:

Router(config)#Interface fa 0/0
Router(config-if)# ip ospf priority 125

OSPF routers will form adjacencies with the DR and BDR. If a change occurs to a link, the update is forwarded only to the DR, which then forwards it to all other routers. This greatly reduces the flooding of LSAs.

Note: The DR election process is not preemptive. Thus, if a router with a higher priority is added to the network, it will not automatically supplant an existing DR. We need to clear the OSPF process for another DR/BDR election, which is not good in a production environment.

OSPF neighbors

In OSPF, routers have to become neighbors first before exchanging link-state advertisements (LSA). After configuring OSPF on routers it will start sending hello packets to each other. The Hello packets also serve as keepalives to allow routers to quickly discover if a neighbor is down. Hello packets also contain a neighbor field that lists the Router IDs of all neighbors the router is connected to.

OSPF routers will only become neighbors if the following parameters within a Hello packet are identical on each router:

  • Area ID
  • Subnet Mask
  • Hello Interval
  • Dead Interval
  • Authentication

7 Benefits of OSPF Protocol

OSPF (Open Shortest Path First) is an Interior Gateway Protocol (IGP). It’s used to decision routing in the autonomous systems. It realizes the Link State Routing Protocol, belonging to IGP, so that it works in the internal system. As a common protocol, let’s know 7 benefits of it.

1. OSPF is a true LOOP- FREE (route-free loop) routing protocol. It is derived from the merits of the algorithm itself.

2. Fast convergence of OSPF: The route changes can be transmitted to the entire autonomous system in the shortest time.

3. The concept of area division is proposed. After the autonomous system is divided into different regions, the summary of routing information between the regions is adopted, which greatly reduces the quantity of routing information to be transmitted. It also makes routing information not expand rapidly as the network scale increases.

4. The protocol itself minimizes the overhead. See below:

(1) For the discovery and maintenance of neighbor relationships, the hello messages that do not contain routing information are sent regularly and are very short. The message containing the routing information is the mechanism that triggers the update. (Send when there is a route change). However, in order to enhance the robustness of the protocol, it is re-issued every 1800 seconds.

(2) In broadcast networks, multicast addresses are used instead of broadcast to reduce the interference to other network devices that do not operate OSPF.

(3) In various types of networks that can be accessed multiple times (broadcast, NBMA), by electing DR, the number of route exchanges (synchronizations) between routers on the same network segment is reduced from O (N*N) times to O (N) times.

(4) The concept of an NSSA area is proposed so that the introduced ASE route is no longer propagated within the NSSA area.

(5) Supports route aggregation on ABRs (Area Border Routers) to further reduce routing information transfer between regions.

(6) In the point-to-point interface type, OSPF over On Demand Circuits is configured so that it no longer sends hello packets periodically and updates routing information regularly. Updates are sent only when the network topology really changes.

5. Through the strict division of the level of routing (a total of four points), it provides more reliable routing.

6. Good security. OSPF supports interface-based plaintext and md5 authentication.

7. OSPF adapts to various scales of networks, up to thousands of units.

OSPF Disadvantages

→ very intensive processor
→ maintaining multiple copies of routing information, increasing the amount of memory needed
→ OSPF can be logically segmented by using areas
not as easy to learn as some other protocols
→ if an entire network is running OSPF, and one link within it is “bouncing” every few seconds, then OSPF updates would dominate the network by informing every other router every time the link changed state.

Thank you! keep learning! keep growing! keep sharing!

Krithika Sharma
If you enjoyed this give it a clap, follow me on Medium for more
Let’s connect on LinkedIn

--

--