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

Analysis of OSPF adjacency in OSPF detailed explanation II

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Analysis of the process of establishing OSPF adjacency

In OSPF network, in order to exchange routing information, neighbor devices must first establish adjacency relationship. Neighbor (Neighbors) relationship and neighbor (Adjacencies) relationship are two different concepts.

Neighbor relationship: after the OSPF device starts, it will send the Hello message out through the OSPF interface. The OSPF device that receives the Hello message will check the parameters defined in the message. If both parties agree, the neighbor relationship will be formed, and the devices at both ends will be neighbors to each other.

Adjacency: after the neighbor relationship is formed, the adjacency relationship will only be established if the devices at both ends successfully exchange DD messages and LSA.

OSPF state machine

There are eight state machines in OSPF, which are: Down, Attempt, Init, 2-way, Exstart, Exchange, Loading, Full.

1. Down: the initial phase of a neighbor session, indicating that no Hello packets were received from the neighbor router during the neighbor failure interval.

2. Attempt: this state only occurs in the NBMA network, indicating that the peer still does not reply to the Hello message after the neighbor failure interval (dead interval) timeout. At this time, the router still sends the Hello message to the peer at each polling time interval (poll interval).

3. Init: the status is Init after receiving the Hello message.

4. 2-way: if the received Hello message contains its own Router ID, the state is 2MWay.If there is no need to form an adjacency, the neighbor state machine stays in this state, otherwise it enters the Exstart state.

5. Exstart: start to negotiate the master-slave relationship and determine the sequence number of the DD, where the status is Exstart.

6. Exchange: after the negotiation of the master-slave relationship, the DD messages are exchanged, and the status is Exchange.

7. The exchange of Loading:DD messages is completed, that is, Exchange done, and the status is Loading.

8. The Full:LSR retransmission list is empty and the status is Full.

Diagram of the OSPF adjacency establishment process:

Note: this picture is a net map, understanding that the blogger has committed a lazy illness. Ha ha.

Detailed explanation of the adjacency establishment process (Broadcast type): [it is easier to understand compared to the diagram]

1. The router sends out the first hello packet in Down. When R2 receives a Hello packet and does not see its own ID in the hello packet, it transfers its relationship with its neighbors to the Init state. Init is an one way state, and when R1 and R2 know each other, they enter the 2-Way state.

2. When you receive a hello packet containing your own router-id, set the status of yourself and your neighbors to 2-way. In Two Way, DB/BDR (MA Network) will be elected. After entering the Two way state (that is, starting with Exstart), the two routers have established a neighbor relationship. But in the end, the adjacency depends on whether it is FULL in the end.

3. Exstart:Exstart interacts with firstDBD, which is mainly used to elect the master-slave relationship (if the router-id is large), to determine the sequence number of the next DD message (using the master serial number) to prepare for lsdb synchronization.

After entering the Exstart state, R1 and R2 respectively send firstDBD messages to each other, and the I position is 1, which represents the first DBD message; M position 1, which means it is not the last DBD message; and MS position 1, which initially thinks that it is the master. After receiving the first DBD message of the other party, the master and slave are elected through router-id, and the value of seq is determined by the master.

According to the figure above, you can see that the second DBD message contains the seq value, the seq value of the first message is nroom1, and so on. When the master sends this DBD message, the slave must give a reply, this is because OSPF is based on IP, there is no confirmation mechanism, and seq is required to do implicit confirmation to ensure reliability.

4. Exchange: Exchange is the exchange of LSA header information through DBD.

5. Loading: wait for the DD message with M bit 0 to enter loading.

After entering the Loading, R1 begins to send LS request messages to R2, requesting link-state information that is found through DD messages in the Exchange state and is not available in the local LSDB. After receiving the LS Request message, R2 sends the LS Update message to R1, which contains the details of the requested link status in the LS Update message. After R1 receives the LS Update message, R1 sends the LS Ack message to R2 to ensure the reliability of information transmission.

6. The FULL:lsdb synchronization is completed and the adjacency relationship is fully established.

OSPF message type:

There are five types of messages in OSPF, which are Hello, DD, LSR, LSU and LSAck. The following is the blogger's experiment to analyze the content and function of the phenomenon.

Hello message: establish and maintain neighbor relationship

DBD message: divided into first DBD message and DBD message.

1. The First DBD message does not carry a LSA header. The master-slave relationship is confirmed by firstDBD. The role of the master is only to control the synchronization of the sequence number. The master-slave election method is Router-ID, and the higher one will be the master.

2. The DBD message only carries the header information of LAS, but not the specific information of LAS. Hosting the full LAS is a LASUpdate package.

LS Resquest message: does not carry a LAS header, only through (announcement ID,LSA L type, linkID) to request a specific entry.

LS Update message: contains the complete information of the real LSA, used to respond to LSRequest.

LSAck message: confirmation of LSU

Routing updates

When the adjacency is established, a routing update occurs later, and the processing flow between routers:

Note: in a broadcast network, DRothers only forms an adjacency relationship with DR and BDR, so the update packet will be sent to the multicast address 224.0.0.6, and the corresponding DR router will also send an update packet containing LSA to all routers on the network that establish a relationship with it, with a multicast address of 224.0.0.5. Next, all routes will flood the diffused LSA from all other interfaces. Although BDR routers also receive and record LSA advertisements from DRothers routers using multicast, it does not repeat flooding spread or acknowledge these LSA unless the DR router fails.

The same features of DR/BDR exist on the NBMA network, except that LSA is sent from the DRothers router to DR and BDR in unicast mode, and the DR router also sends a copy of the LSA to all neighboring routers with which it establishes adjacencies.

Step one:

Update routers send update packets to DR and BDR in multicast mode (224.0.0.6)

Step 2:

DR sends an update packet containing LSA to each router with which it establishes an adjacency via multicast (224.0.0.5)

Step 3:

All routes will flood and spread LSA from all other interfaces

If the neighbor relationship can not be established, the problems and complications will arise.

If the neighbor relationship cannot be established, of course, from the analysis of the process of establishing the neighbor relationship to the 2-way state, it can be proved that the neighbor relationship has been established, and the problems will generally stay in the init state. Hello messages may be affected by the following factors:

1. Router ID

2. ID of the area of the interface

3. Address mask of the interface (MA network): Broadcast, NBMA and P2MP all check the mask

4. Authentication of the interface: it will be divided into details after the authentication. Please follow us.

5. Hello time and dead time of the interface: dead time is 4 times that of hello time.

6. Option field: e bit and N bit, E position is 1, which represents normal area, and N position is 1, which represents NSSA region.

Parsing according to hello message:

From the above figure, we can see that the location of the arrow will affect the establishment of the neighbor relationship, because the establishment of the neighbor relationship will only involve the hello message, so basically all the possible effects are summarized.

What if there is a reason why adjacency cannot be established?

1. The MTU value is inconsistent.

Huawei does not check the MTU by default, and the MTU value is 0 in the DD message. Grab the bag can be seen, the arrow logo:

From the packet capture, we can see that the interface MTU value is 0, but the interface MTU value is 1500 by default. If it is set to 0 here, it means that MTU is not detected. Looking at the router interface from ensp, you can see that the screenshot is as follows:

What if Huawei equipment needs OSPF adjacency establishment to check MTU value?

You can enable ospf mtu-enable under the interface. Note that both APIs need to be enabled.

After opening it, grab the bag and check it:

It is found that the interface MTU value in the DD message is 1500.

If the interface MTU check is enabled, if the MTU value is different, the OSPF adjacency cannot be established and will be stuck in the exstart state. Because OSPF does not define any sharding method, it can only rely on IP package sharding. If MTU consistency is not specified, once the packet sent (usually LSU) is too large and exceeds the maximum packet size that can be received by the receiver, the packet will be lost at the receiver.

2. Broadcast; is not written in NBMA (there are very few frame Relay environments in the real world)

The next chapter is the detailed explanation of OSPF and the detailed explanation of OSPF LSA.

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

Servers

Wechat

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

12
Report