OSPF Routing Protocol – How OSPF Works

The Open Shortest Path First (OSPF) version 2 protocols were defined in RFC 2328 as an Interior Gateway Protocol for routing information within a single Autonomous System. OSPF protocol was developed in order to solve the problem of large-scale routing and to introduce a high functionality nonproprietary Interior Gateway Protocol for the TCP/IP protocol family. The OSPF protocol is a link-state routing protocol that removed the Bellman-Ford vector-based algorithms used in traditional Internet routing protocols such as RIP. OSPF has introduced new concepts such as authentication of a routing update, VLSM, route summarization, etc.

OSPF Metric: In the OSPF metric is called Cost. The cost is calculated, cost of an interface is inversely proportional to the bandwidth of that interface. A higher bandwidth indicates a lower cost.

Download Free CCNA Android Apps from Playstore

Formula for cost

Cost= 100000000/bandwidth in bps.

OSPF network topologies: OSPF has network categories based on architecture topology. In each topology, OSPF has different behavior. So before understanding how OSPF works in different topology we will know what the different types of topology are:

Broadcast Multi-access network

Point-to-point

Point-to-Multipoint

Non-broadcast multi access (NBMA)

OSPF Routing Protocol Configuration

First, you need to enable OSPF on a router. This is done by using the following global configuration command.

Router(config)# router ospf <process ID>

Process ID value is a value ranging from 1-65,535

You need to define which interface OSPF will run and what networks will be advertised. This is done by using the following command from the OSPF configuration mode.

Router(config)# network     IP_address     wildcast_mask     area_id

the OSPF process number doesn’t have to be the same on all routers in order to establish a neighbor relationship, but the area-id has to be the same on all neighboring routers in order for routers to become neighbors.

First, we need to enable OSPF on all routers. Then we need to define what network will be advertised into OSPF. This can be done by the following command.

Router(config)# router ospf 1

Router(config-router)# network   IP_address   wildcast_mask   area_id

Router(config-router)# network   IP_address   wildcast_mask   area_id

Example

Router(config)# router ospf 1

Router(config-router)# network   10.0.1.0   0.0.0.255   area 0

Router(config-router)# network   172.16.0.0  0.0.255.255    area 0

Wildcard masks: A wildcard mask is a mask of bits that indicates which part of an IP address is available for examination.

How to find wildcard masks.

We have to divide subnet mask with 255

Example

255.255.255.252

Divide every octet with 255.

255/255.255/255.255/255.252/255 = 0.0.0.3

Example 2

255.255.255.48

255/255.255/255.255/255.248/255 = 0.0.0.7

Example 3

255.0.0.0

255/255.0/255.0/255/0.255 = 0.255.255.255

Example 4

255.255.0.0

255/255.255/255.0/255.0/255 = 0.0.255.255

Learn MCSA for free – full course with LAB Configuration

Learn Linux for free – full course with LAB Configuration

Designated and Backup Designated Router

Designated Router: A Designated Router (DR) is the router interface elected among all routers on a particular multi-access network segment. Generally assumed to be broadcast multi-access. Special techniques, often vendor-dependent, may be needed to support the DR function on non-broadcast multi-access (NBMA) media. It is usually wise to configure the individual virtual circuits of the NBMA subnet as individual point-to-point lines; the techniques used are implementation-dependent.

Backup Designated Router: A Backup Designated Router (BDR) is a router that becomes the designated router if the current designated router has a problem or fails. The BDR is the OSPF router with the second-highest priority at the time of the last election.

A given router can have some interface that is designated (DR) and others that are backup designated (BDR), and others that are non-designated. If no router is a DR or a BDR on a given subnet, the BDR is first elected, and then a second election is held for the DR.

Based on the network type, the OSPF router can elect one router to be a DR and one router to be a BDR. DR and BDR serve as the central point for exchanging OSPF routing information. Each non-DR or non-BDR router will exchange routing information only with the DR and BDR, instead of exchanging updates with every router on the network segment. DR will then distribute topology information to every other router inside the same area. This greatly reduces OSPF traffic.

To send routing information to a DR or BDR the multicast address of 224.0.0.6 is used. DR sends routing updates to the multicast address of 224.0.0.5. if DR fails, BDR takes over its role of distributing routing information.

Every router on a network segment establishes a full neighbor relationship with the DR and BDR. Non-DR and non-BDR routers establish a two-way neighbor relationship between themselves.

On point-to-point links, a DR and BDR are not elected since only two routers are directly connected. On LANs, DR and BDR have to be elected. Two rules are used to elect a DR and BDR:

  • Router with the highest OSF priority will become a DR. by default, all routers have a priority of 1.
  • If there is a tie, a router with the highest router ID wins the election.

The router with the second-highest OSPF priority or router ID will become a BDR.

The Link-state advertisement (LSA) is used by routers running OSPF to exchange topology information. An LSA contains routing and topology information that describes a part of an OSPF network. Routers exchange LSAs and learn the complete topology of the network until all routers have the exact same topology database.

When two neighbors decide to exchange routers, they send each other a list of LSAs in their respective topology databases. Each router then checks its topology database and sends a Link State Request (LSR) requesting all LSAs not found in its topology table. The other router responds with the Link State Update (LSU) that contains all LSAs requested by the neighbor.

Best Book To Learn CCNA – Crack Cisco Certification & Crack Interviews

Types of LSA

There are several different LSA types in OSPF;

Type 1 LSA: also known as router link advertisement (RLA), a type 1 LSA is sent by every router to other routers in its area. It contains the router, interfaces, IP information, and current interface state. Note that Type 1 LSAs are flooded only across their own area.

Type 2 LSA: also known as network link advertisement (NLA), a Type @ LSA is generated by designated routers to send out information about the state of other routers that are part of the same network. Type 2 LSAs are flooded across their own area only.

Type 3 LSA: also known as summary link advertisement (SLA), a Type 3 LSA is generated by area border router (ABR) and sent toward the area external to the one where they were generated. It contains the IP information and RID of the ABR that is advertising an LSA type 3.

Type 4 LSA: informs the rest of the OSPF domain how to get to the ASBR. The link-state ID includes the router ID of the described ASBR.

Type 5 LSA: also known as external link advertisement, a type 5 LSA is sent by autonomous system boundary router (ASBRs) to advertise routes that are external to the OSPF autonomous system and are flooded everywhere.

Solve Quiz and become an expert in networking.

<==Access CCNA LAB’s for Free==>

I hope you find this article helpful, you can support us by donating just $1. It will really encourage us. EIHeducation


Leave a Reply

Your email address will not be published.