Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A probe into the DR and BDR Election rules of OSPF and the reasons why the highest RouterID is non-DR in the actual environment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

As a typical analytical record, share it with those in need.

1. Description of OSPF protocol

OSPF (Open ShortestPath First) Open shortest path first Protocol is an open dynamic routing protocol developed by IETF. This protocol carries out SPF algorithm according to the current link state. By dividing large networks into logical levels, it can improve the speed of network convergence and effectively avoid loops.

The OSPF packet communication addresses are multicast addresses: 224.0.0.5 and 224.0.0.6.

II. OSPF-Packet type

OSPF packet types are mainly divided into Hello packet, DBD packet, LSR packet, LSU packet and LSAck packet.

1. Hello packets: play the role of keeping alive between OSPF-Router

2. DBD packet: OSPF-Database description information

3. LSR packet: link-state request

4. LSU packets: link-state updates

5. LSAck packet: link-state request confirmation

III. OSPF-NET type

OSPF network types are mainly divided into P-to-P (Point-to-Point) point-to-point network, MA (multi-access) / Broadcast multiaccess / broadcast network, NBMA (Non-broadcastmulti-access) non-broadcast multiaccess network, P-to-MP (Point-to-Multipoint) point-to-multipoint network, and Virtual-links (virtual link) network.

1. P-to-P: a point-to-point network that uses serial links to connect a single pair of routers

2. MA/Broadcast: networks with multiple access, including Ethernet

3. NBMA: you can connect more than two routers, but do not have the ability to broadcast packets

4. P-to-MP: a collection of point-to-point links

5. Virtual-links: an unnumbered point-to-point network.

IV. OSPF-Router type

OSPF routers are divided into DR (Designated Router) designated routers, BDR (Backup Designated Router) backup designated routers, and DR-other other types of routers. In particular, OSPF-Router types are divided not by routers, but by interfaces in the same area, so DR, BDR, and DR-other are only attributes of OSPF interfaces.

1. DR: form adjacency with BDR and DR-other, collect and distribute LSA information to BDR and DR-other routers in the same MA network, in order to reduce the number of LSA in the same area and avoid unnecessary flooding.

2. BDR: form adjacency relationship with DR and DR-other, exchange LSA information with DR and DR-other, and replace DR position at the first time when DR fails.

3. DR-other: form an adjacency relationship with DR and BDR, transfer its own link-state database to the link-state database of DR and BDR, and ensure real-time synchronization between the local database and the link-state database of DR and BDR.

5. OSPF's DR and BDR election rules

In the initial state, the active interface of a router sets DR and BDR to 0.0.0.0, which means that no DR and BDR are elected. Also set WaitTimer, whose value is RouterDeadInterval, to declare itself as DR or BDR if you haven't received any announcements about DR and BDR in that period of time. After the Hello protocol exchange process, each router gets the information about the routers that want to be DR and BDR, and follow these steps to elect DR and BDR:

1. After the router establishes two-way communication with one or more routers, check the priority, DR, and BDR domains in each neighbor's Hello packet. List all routers that meet the DR and BDR election (their priority is greater than 0 and the interface status is greater than two-way communication), list all DR, list all BDR

2. Build a subset of these qualified routers that does not claim to be DR (because routers that claim to be DR cannot be elected as BDR)

3. If one or more neighbors in this subset (including its own interfaces) claim to be BDR in the BDR domain, choose the router with the highest priority, and if the priority is the same, select the router with the highest Router ID as BDR

4. If no router in this subset claims to be BDR, choose the router with the highest priority among its neighbors as BDR, and if the priority is the same, select the router with the largest Router ID as BDR

5. In the list of routers that claim to be DR, if one or more routers claim to be DR, choose the router with the highest priority as DR, and if the priority is the same, select the router with the largest Router ID as DR.

6. If no router claims to be DR, then use the newly elected BDR as the DR

7. If a router is first elected as DR/BDR or without DR/BDR, repeat steps 2 to 6, followed by step 8.

8. Change the port state of the elected router accordingly. The port state of DR is DR,BDR and the port state is BDR, otherwise it is DR other.

In a multiaccess network, DR and BDR establish adjacencies with all other routers in the network, and these adjacencies are all adjacencies in the network.

Due to the introduction of DR and BDR, the logical topology of the network is simplified, and a mesh network is transformed into a star network, which makes the diffusion of protocol packets, the calculation becomes simple, and effectively prevents the occurrence of adjacency oscillation.

In the actual process, a router selects BDR first, but at this time the BDR will not be written to the interface database, but will immediately promote the BDR to the status of DR and write to the database, and then see if anyone claims to be BDR. If no one claims, he will hold the election of BDR again and write to the interface database to send an announcement.

When a router is newly connected to a multiaccess network, it will wait for the waittime timer to expire, and then it will be elected according to the DR/BDR election principle. The reason why it has to wait for the waittime timer to expire is because it has just accessed the network and does not know the state of the network, so he needs to collect hello packets for analysis. If the hello packets it collects have evidence that the network is stable, that is, the DR/BDR election has been completed, the election will not be triggered again even if it is connected to a router with a higher Router-id.

6. A probe into the reasons why the highest RouterID is not DR in the same MA-NET.

In practice, it is often encountered that the router with the highest Router-id in the same broadcast network is not elected as DR.

The root cause of this phenomenon is that on a MA network, the first two DR-eligible routers to initialize will become DR and BDR routers.

As long as the startup time interval of the OSPF processes of the two eligible routers does not exceed the Wait Timer time, the routers will listen to each other for information in the DR and BDR fields in Helo packets, and obey the priority principle, which reflects the principle of fairness to a certain extent; but if the time before and after the startup exceeds the Wait Timer time, then the router that starts first is very likely to become DR, regardless of whether its Router-id is higher or not.

To sum up, in the actual MA network environment, even if the process starts at the same time within 40 seconds, it is rare. More often, the router that starts the OSPF process first is likely to become DR, and the second one is likely to be BDR. Considering the router failure or restart, the actual running effect is that the router with the longest "live" will become DR, which improves the stability of the network to a certain extent.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report