OSPF Packet Format

The OSPF protocol number is 89. OSPF packets are encapsulated into IP packets. OSPF packets are classified into Hello, DD, LSR, LSU, and LSAck packets.

Packet Header Format

The five types of OSPF packets have the same packet header format. The length of an OSPF packet header is 24 bytes. Figure 1 shows an OSPF packet header.

Figure 1 OSPF packet header
Table 1 OSPF packet header fields

Field

Length

Description

Version

8 bits

OSPF version number. For OSPFv2, the value is 2.

Type

8 bits

OSPF packet type. The values are as follows:

  • 1: Hello packet

  • 2: DD packet

  • 3: LSR packet

  • 4: LSU packet

  • 5: LSAck packet

Packet length

16 bits

Length of the OSPF packet with the packet header, in bytes.

Router ID

32 bits

ID of the router that sends the OSPF packet.

Area ID

32 bits

ID of the area to which the router that sends the OSPF packet belongs.

Checksum

16 bits

Checksum of the OSPF packet that does not carry the Authentication field.

AuType

16 bits

Authentication type. The values are as follows:

  • 0: non-authentication

  • 1: simple authentication

  • 2: message digest algorithm 5 (MD5) authentication

    NOTE:

    The MD5 algorithm is insecure and poses security risks.

Authentication

64 bits

This field has different meanings for different AuType values:

  • 0: This field is not defined.

  • 1: This field defines password information.

  • 2: This field contains the key ID, MD5 authentication data length, and sequence number.

MD5 authentication data is added to an OSPF packet and is not included in the Authentication field.

Hello Packet

Hello packets are commonly used packets, which are periodically sent by OSPF interfaces to establish and maintain neighbor relationships. A Hello packet includes information about the designated router (DR), backup designated router (BDR), timers, and known neighbors. Figure 2 shows the format of a Hello packet.

Figure 2 Format of a Hello packet
Table 2 Hello packet fields

Field

Length

Description

Network Mask

32 bits

Mask of the network on which the interface that sends the Hello packet resides.

HelloInterval

16 bits

Interval at which Hello packets are sent.

Options

8 bits

The values are as follows:

  • E: AS-external-LSAs can be flooded.

  • MC: IP multicast packets are forwarded.

  • N/P: Type 7 LSAs are processed.

  • DC: On-demand links are processed.

Rtr Pri

8 bits

DR priority. The default value is 1.

NOTE:

If the DR priority of a router interface is set to 0, the interface cannot participate in a DR or BDR election.

RouterDeadInterval

32 bits

Dead interval. If a device does not receive any Hello packets from its neighbors within a specified dead interval, the neighbors are considered Down.

Designated Router

32 bits

Interface address of the DR.

Backup Designated Router

32 bits

Interface address of the BDR.

Neighbor

32 bits

Router ID of the neighbor.

Table 3 lists the address types, interval types, and default intervals used when Hello packets are transmitted on different networks.

Table 3 Hello packet characteristics for various network types

Network Type

Address Type

Interval Type

Default Interval

Broadcast

Multicast address

HelloInterval

10 seconds for HelloInterval

NBMA

Unicast address

  • HelloInterval is used by the DR, BDR, and router that can become a DR.

  • PollInterval is used when neighbors become Down, and HelloInterval is used in other cases.

30 seconds for HelloInterval

120 seconds for PollInterval

P2P

Multicast address

HelloInterval

10 seconds for HelloInterval

P2MP

Multicast address

HelloInterval

30 seconds for HelloInterval

Routers on the same network segment must have the same HelloInterval and RouterDeadInterval values. Otherwise, they cannot establish neighbor relationships. In addition, on an NBMA network, the PollInterval values must be the same at both ends.

DD Packet

During an adjacency initialization, two routers use DD packets to describe their own link state databases (LSDBs) for LSDB synchronization. A DD packet contains the header of each LSA in an LSDB. An LSA header uniquely identifies an LSA. The LSA header occupies only a small portion of the LSA, which reduces the amount of traffic transmitted between routers. A neighbor can use the LSA header to check whether it already has the LSA. When two routers exchange DD packets, one functions as the master, and the other functions as the slave. The master defines a start sequence number and increases the sequence number by one each time it sends a DD packet. After the slave receives a DD packet, it uses the sequence number carried in the DD packet for acknowledgment.

Figure 3 shows the format of a DD packet.

Figure 3 Format of a DD packet
Table 4 DD packet fields

Field

Length

Description

Interface MTU

16 bits

Maximum size of an IP packet that an interface can send without fragmenting the packet.

Options

8 bits

The values are as follows:

  • E: AS-external-LSAs can be flooded.

  • MC: IP multicast packets are forwarded.

  • N/P: Type 7 LSAs are processed.

  • DC: On-demand links are processed.

I

1 bit

If the DD packet is the first packet among multiple consecutive DD packets sent by a device, this field is set to 1. In other cases, this field is set to 0.

M (More)

1 bit

If the DD packet is the last packet among multiple consecutive DD packets sent by a device, this field is set to 0. In other cases, this field is set to 1.

M/S (Master/Slave)

1 bit

When two OSPF devices exchange DD packets, they negotiate a master/slave relationship. The device with a larger router ID becomes the master. If this field is set to 1, the DD packet is sent by the master.

DD sequence number

32 bits

Sequence number of the DD packet. The master and slave use the sequence number to ensure that DD packets are correctly transmitted.

LSA Headers

-

LSA header information included in the DD packet.

LSR Packet

After two routers exchange DD packets, they send LSR packets to request each other's LSAs. The LSR packets contain the summaries of the requested LSAs. Figure 4 shows the format of an LSR packet.

Figure 4 Format of an LSR packet
Table 5 LSR packet fields

Field

Length

Description

LS type

32 bits

Type of the LSA.

Link State ID

32 bits

This field together with the LS type field describes an LSA in an AS.

Advertising Router

32 bits

Router ID of the router that generates the LSA.

The LS type, Link State ID, and Advertising Router fields can uniquely identify an LSA. If two LSAs have the same LS type, Link State ID, and Advertising Router fields, a device uses the LS sequence number, LS checksum, and LS age fields to obtain a required LSA.

LSU Packet

A router uses an LSU packet to transmit LSAs requested by its neighbors or to flood its own updated LSAs. The LSU packet contains a set of LSAs. For multicast and broadcast networks, LSU packets are multicast to flood LSAs. To ensure reliable LSA flooding, a device uses an LSAck packet to acknowledge the LSAs contained in an LSU packet that is received from a neighbor. If an LSA fails to be acknowledged, the device retransmits the LSA to the neighbor. Figure 5 shows the format of an LSU packet.

Figure 5 Format of an LSU packet
Table 6 LSU packet field

Field

Length

Description

Number of LSAs

32 bits

Number of LSAs contained in the LSU packet

LSAck Packet

A device uses an LSAck packet to acknowledge the LSAs contained in a received LSU packet. The LSAs can be acknowledged using LSA headers. LSAck packets can be transmitted in unicast or multicast mode, and the transmission mode is determined by the link type. Figure 6 shows the format of an LSAck packet.

Figure 6 Format of an LSAck packet
Table 7 LSAck packet field

Field

Length

Description

LSAs Headers

Determined by the header length of the LSA to be acknowledged.

This field is used to acknowledge an LSA.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >