OSPFv2 Basics 01_Overall Introduction

Table of contents

1. Introduction to OSPF

2. Introduction to the working principle of OSPF

3.OSPF basic concepts

3.1 OSPF system

 3.1.1 OSPF router classification

3.1.2 OSPF area

(1) OSPF area classification

(2) OSPF special area

3.1.3 OSPF routing types

3.2 OSPF messages

3.2.1 OSPF header format

3.2.2 OSPF message format

(1) Hello message format

(2) DD message format

(3) LSR message format

(4) LSU message format

(5) LSAck message format

3.2.3 LSA format

(1) LSA header format

(2) LSA format

3.3 OSPF network types


1. Introduction to OSPF

The OSPF (Open Shortest Path First) protocol is a link state protocol used for routing. It is defined by the Internet Engineering Task Force (IETF) and is widely used in enterprise and service provider networks.

OSPF can adaptively calculate paths in large networks and select the optimal path to forward data packets, thereby improving network reliability, flexibility, and performance.

It uses the link state database (LSDB) to store network topology information, passes the information through a flooding algorithm, and finally calculates the shortest path tree of the network.

This protocol supports VLSM (Variable-Length Subnet Mask) address allocation, which can cope with complex network topologies. It also supports multiple routing types, such as multi-path routing, default routing, and regional routing.

2. Introduction to the working principle of OSPF

  • Establish neighbor relationships through Hello messages
  • Flood LSA and complete LSDB record synchronization
  • The SPF algorithm calculates and forms routes

Figure 2-1 Introduction to the working principle of OSPF 

3.OSPF basic concepts

3.1 OSPF system

Figure 3-1 OSPF system

 3.1.1 OSPF router classification

  • Internal Router (IR, Internal Router) : A router where all OSPF interfaces are in the same area.
  • Backbone Router (BR) : A router that has at least one OSPF interface belonging to the backbone area (area 0).
  • Area Border Routers (ABR) : At least one OSPF interface belongs to the backbone area and at least one OSPF interface is connected to the non-backbone area. ABR is used to connect the backbone area and the non-backbone area.
  • Autonomous system border router (ASBR, AS Boundary Router) : At least one OSPF interface belongs to an OSPF area (any area), and the other interface connects to other AS border routers and is used to exchange router information.

3.1.2 OSPF area

(1) OSPF area classification

OSPF areas are divided into backbone areas and non-backbone areas. Backbone areas and non-backbone areas are collectively called normal areas.

  • non-backbone area

The area number of non-backbone areas cannot be 0.0.0.0. Non-backbone areas connect to backbone areas through physical connections or virtual connections.

  • backbone area

The area number of the backbone area is fixed at 0.0.0.0. The function of the backbone area is to summarize the LSA information of each area and advertise it to each area connected to the backbone area through ABR.

OSPF area division regulations:

1. The backbone area must be continuous, and the separated backbone areas need to be connected through virtual connections.

2. The non-backbone area must be connected to the backbone area (through physical connection or virtual connection).

(2) OSPF special area

OSPF special areas are mainly distinguished by the following information: the number of ABRs and ASBRs, whether there are virtual connections passing through the area, whether they are located at the edge of the AS, and which LSAs are allowed to enter the area.

According to the differences in the above information, OSPF special areas can be divided into the following four types:

  • Stub area

The Stub area needs to meet the following conditions:

  • There is only one ABR and no ASBR.
  • There are no virtual connections.
  • Non-backbone areas.
  • On the edge of AS.

The stub area only allows the same AS (autonomous system) Type 1 LSA, Type 2 LSA, and Type 3 LSA to be advertised in the area, which can reduce the number of routing table entries in the area.

  • Totally Stub area

The Totally Stub area needs to meet the following conditions:

  • There is only one ABR and no ASBR.
  • There are no virtual connections.
  • Non-backbone areas.
  • On the edge of AS.

The difference between a Totally Stub area and a Stub area is that a Totally Stub area only allows Type 1 LSA and Type 2 LSA, and does not allow Type 3 LSA to be advertised within the area, thus further reducing the number of routing table entries in the area.

How does the Totally Stub area communicate with external areas?

ABR generates a default Summary LSA (Type 3 LSA) and advertises it to the Totally Stub area. Routers in the area communicate with the outside world through ABR.

  • NSSA (Non-Sure Stub) Area

NSSA areas need to meet the following conditions:

  • There is greater than or equal to one ABR and there is greater than or equal to one ASBR.
  • There are no virtual connections.
  • Non-backbone areas.

The NSSA area allows the same AS (autonomous system) Type 1 LSA, Type 2 LSA, and Type 3 LSA to be advertised in the area, and allows other AS (autonomous system) routes to be imported into the area as Type 7 LSA through the ASBR. The NSSA area ABR will pass Type 5 LSA is advertised to other areas within the AS.

  • Totally NSSA (completely non-pure terminal) area

The Totally NSSA region needs to meet the following conditions:

  • There is greater than or equal to one ABR and there is greater than or equal to one ASBR.
  • There are no virtual connections.
  • Non-backbone areas.

Totally NSSA areas allow Type 1 LSAs of the same AS (autonomous system), Type 2 LSAs are advertised within the area, and Type 3 LSAs are not allowed to be advertised within the area.

Totally NSSA area allows different AS (autonomous system) Type 7 LSA in this area. The NSSA area ABR will advertise it to other areas in the AS (autonomous system) through Type 5 LSA.

How does the Totally NSSA area communicate with other areas within the AS (autonomous system)?

ABR generates a default Summary LSA (Type 3 LSA) advertisement to the Totally NSSA area, and routers in the area communicate with the outside world through ABR .

Table 3-1 OSPF special areas

3.1.3 OSPF routing types

OSPF routes can be divided into 4 categories:

  • Intra Area Route
  • Inter Area Route
  • Type-1 External Route
  • Type-2 External Route

 Table 3-2 OSPF route types

3.2 OSPF messages

There are 5 types of messages in OSPF: Hello messages, DD messages, LSR messages, LSU messages, and LSAck messages.

  • Hello message

Hello messages are used to maintain the neighbor router list and detect whether neighbor routers are online. This packet is set with the OSPF management IP address, including identification number, priority, neighbor IP address and other information.

  • DD (Database Description) message

DD messages are used to exchange summary information of the LSDB (Link State Database) to determine which LSAs (Link State Advertisements) need to be transmitted and received. The information transmitted by DD packets is LSA header information. The purpose of transmitting LSA headers is to reduce network traffic. Usually routers have a large number of LSAs. If complete LSA information is transmitted, it will cause large network traffic problems.

  • LSR (Link State Request) message

The LSR message is used to request a complete copy of one or more LSAs. LSR messages also contain only LSA header information.

  • LSU (Link State Update) message

LSU messages are used to transmit complete copies of one or more LSAs. When there are changes in the router's LSDB, LSU messages will notify other routers of the updated LSDB. Only LSU will carry complete LSA information.

  • LSAck (Link State Acknowledgment) message

The LSAck message is used to confirm the received LSA and send a confirmation message to the sender. After the router sends the LSU message, if it does not receive the peer LSAck message, it will retransmit the LSA.

 Figure 3-2 OSPF message exchange process

3.2.1 OSPF header format

Figure 3-3 OSPF header format

 Version: OSPF version, 1 byte.

Message Type : Message type, 1 byte.

  • 1: Hello message
  • 2: DD message
  • 3: LSR message
  • 4: LSU message
  • 5: LSAck message

Packet Length: OSPF packet length, 2 bytes.

Source OSPF Router: Router ID, 4 bytes, the source router ID that sends OSPF messages.

Area ID: Area ID, 4 bytes.

Checksum: Checksum, 2 bytes.

Auth Type : Authentication type, 2 bytes.

Auth Data: Authentication data, 4 bytes.

3.2.2 OSPF message format

(1) Hello message format

Figure 3-4 Hello message format

Network Mask: 4 bytes, the subnet mask of the interface IP that sends the Hello message.

Hello Interval: 2 bytes, the time interval for sending Hello messages.

Options: 1 byte, options, consisting of the following bits.

  • DN: Down bit
  • O: Opaque bit
  • DC: Demand Circuit bits
  • L: LLS Data Block bit
  • NP: N or P bits
  • MC: Multicast bit
  • E: External Routing bit
  • MT: Multi-Topology bit

Router Pri: 1 byte, the DR priority of this router.

Router Dead Interval: 4 bytes, local router failure time.

Designated Router: 4 bytes, DR interface IP address.

Backup Designated Router, 4 bytes, BDR interface IP address.

Active Neighbor: 4 bytes, the Router ID of the discovered neighbor router.

(2) DD message format

 Figure 3-5 DD message format

Interface MTU: 2 bytes, MTU value of the interface that sends DD messages.

Options: 1 byte, options, composed of the following bits

  • DN: Down bit
  • O: Opaque bit
  • DC: Demand Circuit bits
  • L: LLS Data Block bit
  • NP: N or P bits
  • MC: Multicast bit
  • E: External Routing bit
  • MT: Multi-Topology bit

DB Description: DB description, 1 byte

  • I: 1 bit, multiple DD messages, the first DD message is set to 1.
  • M: 1 bit, multiple DD messages, the last DD message is set to 1.
  • MS: 1 bit, sets the master-slave relationship between both parties in the DD message.

DD Sequence: 4 bytes, DD message sequence number.

LSA Headers: 4 bytes, LSA header information list.

(3) LSR message format

Figure 3-6 LSR message format

 Link State Request consists of the following parts:

LS Type: 4 bytes, requested LSA type.

Link State ID : 4 bytes, the actual meaning is determined by the LSA type.

  • Type 1 LSA: Router ID of the router that generated the LSA.
  • Type 2 LSA: DR interface IP address.
  • Type 3 LSA: Destination network IP address.
  • Type 4 LSA:ASBR Router ID。
  • Type 5 LSA: Destination network IP address.

Advertising Router: 4 bytes, the Router ID of the router that sends this message.

(4) LSU message format

Figure 3-7 LSU message format

 Number of LSAs: 4 bytes, the number of LSAs in the message.

LSA: LSA list, the LSA format is described in detail later.

(5) LSAck message format

Figure 3-8 LSAck message format

 LSA Headers: LSA header list.

3.2.3 LSA format

(1) LSA header format

Figure 3-9 LSA header format

LS age: LSA age, 2 bytes, the age of the LSA (the time since the last generation).

Options: Options, 1 byte, LS type, range, generator type and other options.

LS type: LSA type, 1 byte. Common LSA types are as follows:

  • 1:Router-LSA,
  • 2:Network-LSA
  • 3:Network-summary-LSA
  • 4:ASBR-summary-LSA
  • 5:AS-external-LSA
  • 7:NSSA-external-LSA

Link state ID: Link state ID, 4 bytes, identifier of LSA.

Advertising Router: Advertising LSA route ID, 4 bytes.

LS sequence number: LSA sequence number, 4 bytes.

LS Checksum: LSA checksum, 2 bytes, the check range is the LSA data except the LS age field.

Length: The length of the LSA, 2 bytes. LSA body is of variable length. The specific content of the LSA.

(2) LSA format

  • Type 1 LSA: Router-LSA

Figure 3-10 Router-LSA format

 V bit: 1 bit. If the router that hosts this LSA has a virtual connection set up, this bit is set to 1, otherwise it is set to 0.

E bit: 1 bit, if the router that generates this LSA is an ASBR, this bit is set to 1, otherwise it is set to 0.

B bit: 1 bit. If the router that holds this LSA is an ABR, this bit is set to 1, otherwise it is set to 0.

Number of Links: 2 bytes, the number of router OSPF links.

Link ID: 4 bytes, the actual meaning is determined by Link Type.

Link Data: 4 bytes, the actual meaning is determined by Link Type.

Link Type: 1 byte, actual link type

  • 1.P2P (point-to-point network): Link ID indicates the Router ID of the neighbor routing device, and Link Data indicates the IP address of the router interface that sends the LSA.
  • 2.Transit (transport network): Link ID indicates the IP address of the DR interface, and Link Data indicates the IP address of the router interface that sends the LSA.
  • 3. Stub (stub network): Link ID represents the IP network or subnet address, and Link Data represents the subnet mask of the network where the router interface that sends the LSA is located.
  • 4.Virtual Link: Link ID represents the Router ID of the neighbor routing device, and Link Data represents the MIB-II ifIndex (interface index) value of the router interface that sends the LSA.

TOS: 1 byte, fixed to 0.

Metric: 2 bytes, link overhead.

  • Type 2 LSA: Network-LSA

Figure 3-11 Network-LSA format

 Network Mask: 4 bytes, the network subnet mask.

Attached Router: 4 bytes, the Router ID of all routers in this network segment that have neighbor relationships with the DR.

  • Type 3 LSA: Network-summary-LSA

Figure 3-12 Network-summary-LSA format

Network Mask: 4 bytes, subnet mask of the destination network.

TOS: 1 byte, service type.

Metric: 3 bytes, link overhead.

  •  Type 4 LSA:ASBRjùhéLSA(ASBR-summary-LSA)
  • Type 5 LSA: Autonomous system external LSA (AS-external-LSA)

3.3 OSPF network types

OSPF networks can be divided into the following 4 types:

  • P2P (point-to-point, point-to-point) type.
  • P2MP (point-to-multipoint, point-to-multipoint) type.
  • BMA (Broadcast multi-Access) type.
  • NBMA (Non-Broadcast multi-Acces) type.

Guess you like

Origin blog.csdn.net/weixin_28673511/article/details/131558313