Who knows? OSPF routing protocol is enough to read this article!

Who knows? OSPF routing protocol is enough to read this article!

After the release of the interesting routing series, I received a lot of messages about OSPF. In order to meet the needs of fans, here comes a lot of OSPF dry goods~

PART.01Why is RIP “outdated”?

If you want to talk about OSPF, you have to start with one of the oldest routing protocols - RIP (Routing Information Protocol).

The most prominent feature of RIP is that it uses the hop count (the number of routers a message passes through) as a measure of the quality of a route: the route with the smallest hop count is considered the best.

With the development of the network, the types and characteristics of links (transmission channels between devices) are constantly upgraded and changed. Considering the number of hops alone can no longer objectively reflect the quality of routing.

For example, there are two paths to the same destination: A→B and A→C→D→B.

Although the A→B path is the shortest, it is not suitable for practical applications. It is more reasonable to measure network quality by network bandwidth and link status. For example, in the above figure, the A→C→D→B path with a larger bandwidth has better results.

At the same time, RIP limits the maximum number of hops to 15, and hop number 16 becomes the "unreachable distance" of the RIP routing protocol ~ Therefore, RIP cannot be used to build large-scale networks.

RIP is outdated not only because of its poor scalability, but also because of its slow convergence speed and the easy generation of loops. However, I will not go into details here.

PART.02How does OSPF calculate routes?

Next, we will introduce the hottest dynamic routing protocol - OSPF (Open Shortest Path First)!

Unlike RIP, OSPF is a link-state routing protocol that collects topology changes around routers and forms a reliable routing structure.

If RIP provides a road sign, telling you which way to go next, but you still get lost (causing a loop) after going around in circles, then OSPF provides a map. Each router running the OSPF protocol has a complete network map. With a map in hand, you will never get lost again!

The cost of OSPF can be the routing distance, link throughput, or link reliability. This routing metric is more flexible and accurate than the hop count of the RIP protocol and is suitable for larger and more complex networks.

The following network is used as an example to illustrate the process of OSPF calculating routes.

The following figure shows a network consisting of four routers, with the cost from one router to another marked next to the line. To simplify the problem, we assume that the cost of sending messages between two routers connected by the same link is the same.

First, each router generates an LSA (Link State Advertisement) based on the network topology around it, and sends this LSA to all other routers in the network by sending OSPF protocol packets to each other. In this way, each router receives the LSA of other routers. All LSAs are put together and called LSDB (Link State Database). Obviously, the LSDBs of these four routers are the same.

Secondly, since an LSA describes the network topology around a router, the LSDB describes the entire network topology. The router converts the LSDB into a vector weight graph, which is a true reflection of the entire network topology. Therefore, the four routers get exactly the same graph.

Finally, and most importantly, each router uses the shortest path first (SPF) algorithm to calculate a shortest path tree (select the path with the smallest cost value) with itself as the root node, and generates the shortest routes to other routers in the network through the shortest path tree to form a routing table. The routing tables obtained by each of the four routers are different.

From the above analysis, we can conclude that the OSPF protocol calculates routes in the following three main steps.

  1. Describe the network topology around this router and generate LSA.
  2. Spread the LSA generated by itself in the autonomous system and collect all LSAs generated by other routers at the same time.
  3. Calculates routes based on all collected LSAs.

The way OSPF calculates routes is so simple~~

So why is OSPF more suitable for large networks?

PART.04How does OSPF adapt to large networks?

Let’s take a look at how OSPF can adapt to large networks!

Think back to when we were in school, how did teachers manage a class of students?

I will answer for you: Of course, divide into groups and select group leaders!

Divide into groups: Divide network areas

OSPF is applied to large networks, for example, there may be dozens or hundreds of routers in the network.

When these routers run the OSPF protocol and transmit and collect LSAs, the network will be filled with these protocol messages. The LSDB capacity will be very large, and the running of the SPF algorithm will be very slow, which is not conducive to the normal calculation and forwarding of routes.

OSPF solves this problem by setting up areas. As shown in the figure, a large network is divided into several small networks, each of which is called an area. Areas are numbered with a number. Among them, area 0 is called the backbone area, and other areas with non-0 numbers are called non-backbone areas. It is stipulated that non-backbone areas must be connected to the backbone area.

After such processing, OSPF has the following advantages.

  • Only the LSDBs of routers in the same area will be synchronized, and routing changes will be updated first in the local area.
  • When routing update information is transmitted to other areas, routing aggregation can be performed on the area border router (ABR) to reduce the number of LSAs announced to other areas, thereby minimizing the impact of network topology changes.

This can effectively solve the problem of slow routing calculation and forwarding speed. Of course, in actual networking applications, OSPF also defines many optimization methods for calculating routes based on different regional characteristics, which will not be described here one by one.

We know that the OSPF protocol requires that each area must be directly connected to the backbone area (Area 0), but in actual networking, the network situation is very complex, and sometimes when dividing areas, it is impossible to ensure that each area meets this requirement. At this time, virtual link technology is needed to solve this problem.

A virtual link is a logical connection channel established between two ABRs through a non-backbone area (also called a transition area). It must be configured on the ABRs at both ends.

As shown in the figure above, a virtual link is established between Router C and Router E, which makes Area 3 and backbone area Area 0 logically connected. Area 1 is the transition area.

"Logical channel" means that other routers running OSPF between two ABRs only forward packets, which is equivalent to forming a point-to-point connection between the two ABRs. Therefore, on this connection, various interface parameters can be configured just like physical ports.

Selecting a leader: OSPF election

On broadcast and NBMA (Non-Broadcast Multiple Access) networks, any two routers need to transmit routing information. If there are N routers in the network, then "N×(N-1)/2" transmissions must be established. This is unnecessary and wastes precious bandwidth resources.

To solve this problem, the OSPF protocol designates a router as the "group leader" - the DR (Designated Router) to be responsible for transmitting information. All routers only send routing information to the DR, and the DR then sends the routing information to other routers in the same network segment.

Two routers that are not DRs (DR Others) no longer establish adjacency relationships and no longer exchange any routing information. In this way, only N-1 adjacency relationships need to be established between the same network segment, and each route change only requires 2×(N-1) transmissions.

Although the method of selecting a group leader is very effective, if the group leader is not there, who will be responsible for managing the entire group?

Therefore, OSPF also defines the "deputy leader" - BDR (Backup Designate Router).

The BDR is a backup of the DR. When the DR is elected, the BDR is also elected. The BDR also establishes adjacency with all routers in the network segment and exchanges routing information.

Once the DR fails, the BDR will immediately become the DR. Since there is no need for re-election and the adjacency relationship has been established in advance, the process of BDR replacing DR is very short. After the BDR successfully "ascends" to become the DR, a new BDR needs to be re-elected, but this election process will not affect the calculation of routes.

I wonder if the fans have gained something from the previous introduction to OSPF?

<<:  The large-scale replication of 5G private network applications urgently needs policy support

>>:  Can lightweighting become the spark that sets 5G off?

Recommend

Accelerating NFV interoperability testing

Many service providers have deployed network func...

Faced with slowing growth, operators need to change their roles

The past year was the "golden period" f...

How to create a new financing model for product-based IT

As technology departments move away from traditio...

What are the deployments and arrangements for 5G in 2022? MIIT responds

On January 20, the State Council Information Offi...

Inspur Network Electronics Range Training Base officially launched

Recently, the "Inspur Network Electronic Tar...

F5 Cloud Native Keywords: Transformation, Construction, Integration

[51CTO.com original article] Cloud native is one ...

Talk about IPv6 and Happy Eyeballs

[[256713]] Let's look at a picture first. Fro...

How edge computing will benefit from 5G technology

With the development of 5G technology, more and m...

When to use 5G and when to use Wi-Fi 6

[[357301]] 5G is a cellular service, and Wi-Fi 6 ...

2G/3G will be phased out soon, and NB-IoT will start to take over

With the upcoming decommissioning of 2G/3G networ...