Adjacency establishing and LSAs exchanging in OSPF - Series of OSPF Episode 2

Latest reply: Nov 28, 2018 09:22:52 593 4 2 0

Want to know more about OSPF? Please refer to [Series of OSPF] Episode 1 OSPF summary and concept

In this episode, we will introduce you guys how the routers establish adjacency relationship and exchange LSAs. 

As we talked in the previous episode, OSPF can support 4 types of network, broadcast, NBMA, P2P and P2MP. In broadcast and NBMA, DR and BDR will be elected to restrain the unnecessary multicast traffics. On the contrary, there is no need to elect DR or BDR.

In this episode, let's talk about how the OSPF works in broadcast and NBMA.
We use the following figure as an example. In this network topology environment, three router, AR1 AR2 and AR3, are running OSPF with area 0.


When OSPF is configured on the router, and network segments are announced into OSPF area, router will send hello packet immediately from the interfaces which IP addresses match the announced network segment.Because at the beginning of OSPF started, DR and BDR haven't elected out. So the hello packet sender regard itself as DR and send hello packet to multicast address 


from the capture result, as we said, hello packets are sent to with DR and BDR address which means unknown DR and BDR.
Let's analyse this OSPF hello packet more deeper. 

From the captured packet, we can see OSPF are packaged in IP packet, and use IP protocol number 89, TTL in the IP header is 1. In the OSPF payload, hello packet follows after the OSPF header. Fields in the OSPF header are used as below: 

  • version: version number of the OSPF, when version value is 2, means OSPFv2 is implemented, when version value is 3, OSPFv3 is implemented. By the way, OSPFv2 is used in IPv4 network environment, OSPFv3 is used in IPv6 environment. 
  • message type: the type of the OSPF packet. The value from 1 to 5 corresponding to hello packet, DBD packet, LSR packet, LSU packet and LSAck packet. 
  • packet length: the whole length of the OSPF packet in bytes, including the OSPF header. 
  • source OSPF router: RID(router ID) of the sender. The maximum loopback interface's IP address is designated as the RID, if no loopback interface is configured, the maximum physical interface's IP address will be choosed. 
  • area ID: the area where the router interface that sent the pakcet is located to. 
  • packet checksum: the checksum result of the whole packet. 
  • auth type: authentication type. The value from 0 to 2 corresponding to no authentication, plain text authentication, and MD5 authentication. 
  • authentication: the value is based on the authentication type. when auth type is 0, when the value is null, when auth type is 1, the value is password information, when auth type is 2, this field includes information about Key ID, MD5 authentication data length, and serial number. 

In the OSPF hello packet:

  • network mask: the mask number of router interface that sent this packet. 
  • hello interval: interval of the router send hello pakcet, the value is 10 by default. 
  • router priority: router's priority, a larger router priority makes the router become the DR or BDR, when router priority is 0, it means router doesn't  participate in the calculation of DR and BDR. 
  • router dead interval: when router does't receive hello packets from the neighbor router out of the dead interval, it regards the neighbor router failure, and delete the LSAs learned from the neighbor.Usually, router dead interval is four times as hello interval, when we modify the hello interval, the dead interval will be modified automatically, on the contrary, when we modify the dead interval, hello interval wouldn't change. When routers' hello interval and dead interval not match, the neighbor relationship establishing will fail. So except the specific requirements, it's better not to modify the hello interval and dead interval. 
  • designated router: interface IP address of the DR 
  • backup designated router: interface IP address of the BDR 

when router receive hello packet, if it doesn't find its RID in the hello pakcet, it sets the neighbor router to the init state. The router will add its own RID into the OSPF hello packet when next sending hello packet. If router receive hello pakcet with ite own RID exist in it, it sets the neighbor router to the 2-way state.


  • active neighbor: RID of router. router received hello packets from the router that the RID belongs to. 

2-way is the first stable state of OSPF. As we said, In a multi-access network, to restrain the unnecessary multicast traffics, DR and BDR are elected. Between two DRother routers, they will keep in 2-way state, and between DRother and DR or DRother and BDR, There will be further state transitions.

After 2-way state, between DR and DRother, they will spread DBD packet unicast to each other and migrate to ex-start state, begin to elect master and slave router through exchange DBD packet which doesn't carry LSAs.
since we have introduce OSPF header before, here we introduce DBD packet directly. 


  • interface MTU: RFC 2328 describes the interface MTU as: The size in bytes of the largest IP datagram that can be sent out the associated interface, without fragmentation. This value is 0 by default on Huawei network equipments, if command ospf mtu-enable which disabled by default is enabled under interface view, this field will equal to the interface's MTU. 
  • I: when send more than one DBd packets, and this is the first one, I field will be set to 1, or it will be set to 0. 
  • M: with more than one DBD packets sent, in the lastest DBD packet, M field is set to 0, or it will be set to 1. 
  • MS: before routers exchange DBD packets, master router and slave router should be determined first. This field is used to mark the master router when it is set to 1. 

When the first DBD packet is spread out, both I, M and MS field are set to 1. Since every router regard themselves as the master before the master elected out, this will make the MS bit been set to 1. The first DBD packet carries none LSAs, it's used to negotiate the master and slave router, after that, more DBD packets which will carry LSAs will be spread out. So the I and M field also been set to 1. The election of master router is depended on the RID, the router with a larger RID will be elected as master router.

When router receive DBD packet with I field set to 0, it set the neighbor router to ex-change state. In this DBD packet, LSA headers are carried, receiver will store these LSA headers. When the last DBD packet received(by checking the M field in the DBD packet), router will check if there are some LSAs that doesn't exist in its own LSDB.


  • LSA header: A brief description of the LSA, it doesn't contain the detailed LSA information. 

If the router find some LSA that doesn't exist in its own LSDB, it will set neighbor router to loading state and begin to send LSR packet to request detailed associated LSAs.

In the next episode, we will introduce how the OSPF routers request the detailed associated LSAs and update its own LSDB.

  • x
  • convention:

Created Nov 27, 2018 06:31:16 Helpful(0) Helpful(0)

OSPF routing protocol is a link-state routing protocol for Internet Protocol (IP) networks. The protocol uses the internal gateway protocol (IGP) of link state routing algorithm to work within a single autonomous system (AS). OSPFv2 protocol for IPv4 is defined in RFC 2328 [1], and RFC 5340 [2] defines OSPFv3 for IPv6.
  • x
  • convention:

Created Nov 28, 2018 09:22:26 Helpful(0) Helpful(0)

good examples
  • x
  • convention:

If you think my post/reply is useful, please click the Helpful button and flag my post as a BEST ANSWER. Thanks
Created Nov 28, 2018 09:22:39 Helpful(0) Helpful(0)

easy explanations
  • x
  • convention:

If you think my post/reply is useful, please click the Helpful button and flag my post as a BEST ANSWER. Thanks
Created Nov 28, 2018 09:22:52 Helpful(0) Helpful(0)

thanks .....
  • x
  • convention:

If you think my post/reply is useful, please click the Helpful button and flag my post as a BEST ANSWER. Thanks


You need to log in to reply to the post Login | Register

Notice Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " Privacy."
If the attachment button is not available, update the Adobe Flash Player to the latest version!
Login and enjoy all the member benefits

Login and enjoy all the member benefits