Introduction to OSPF dynamic routing and sharing of study notes

What is OSPF?

OSPF (Open Shortest Path First) is an internal gateway protocol based on link state developed by the IETF (Internet Engineering Task Force). Currently, OSPF Version 2 is used for the IPv4 protocol.

Why use OSPF?

OSPF is one of the dynamic routing protocols. OSPF uses the shortest path tree algorithm to calculate routes based on the collected link status. Compared with routing protocols based on vector routing, OSPF has a healthier transmission mechanism and is suitable for any scale. The internet.

How does OSPF work?

Each OSPF router generates an LSA (Link State Advertisement) according to its surrounding network topology and sends it to the surrounding OSPF routers; each router collects the LSAs of other routers, and all LSAs are put together to form an LSDB (link State database). The OSPF router converts the LSDB into a topology map, and then calculates the shortest path to each node according to the SPF algorithm.

Features of OSPF

1. Wide application range: OSPF protocol supports networks of various sizes, and can support hundreds of routers at most.

2. Fast convergence: The OSPF protocol sends update messages immediately after the network topology changes, so that this change is synchronized in the autonomous system.

3. No self-loop: Since OSPF uses the shortest path tree algorithm to calculate the route based on the collected link status, it is guaranteed from the algorithm itself that no self-loop route will be generated.

4. Area division: The OSPF protocol allows the autonomous system's network to be divided into areas for management. The reduction of the router link state database reduces the memory consumption and the burden of the CPU; the reduction of routing information transmitted between regions reduces the occupation of network bandwidth.

5. Equal-cost routing: OSPF supports multiple equal-cost routes to the same destination address.

 6. Routing classification: OSPF uses 4 different types of routing, in order of preference: intra-area routing, inter-area routing, type 1 external routing, and type 2 external routing.

7. Support verification: OSPF supports interface-based message verification to ensure the security of message interaction and routing calculations.

8. Multicast sending: OSPF uses multicast addresses to send protocol messages on certain types of links to reduce interference to other devices.

Advantages of OSPF

1.Open, open, good compatibility, support from various manufacturers.

2. The SPF algorithm is a tree algorithm, clear the real network topology in the area, the routing calculation is accurate, and there is no loop

3. Compared with RIP, there is no hop limit, which can support medium and large networks.

4. Compared with RIP, the convergence speed is faster

5. Compared with RIP, the cost of the interface (determined by the bandwidth by default) is used to judge the pros and cons of routing, not based on the number of hops.

OSPF area

An OSPF network can be divided into multiple areas (Area), if it contains only one area, such an OSPF network is called a single-area OSPF network; if an OSPF network contains multiple areas, such an OSPF network is called a multi-area OSPF network.

In an OSPF network, each area will have a corresponding number, Area-ID, where the ID can be any decimal number. Generally, the area with an Area-ID of 0 is called the backbone area, and other areas are called standard areas. A single-area OSPF network contains only one area, so this area must be a backbone area (it is still possible without Area 0, but it is not conducive to expansion). In a multi-area OSPF network, all networks in non-backbone areas must be directly connected to the backbone area, and non-backbone areas are not allowed to be directly connected. Therefore, communication between standard areas can only be carried out through the backbone area.

image.png

4 types of routers in OSPF area

IR: If an OSPF router belongs to a single area, that is, all interfaces of the router belong to the same area, then this router is called IR (Internal Router).

ABR: If some interfaces of a router belong to Area 0 and other interfaces belong to other areas, such a router is called ABR (Area Border Routing).

ASBR: If a router is connected to a network outside of the local network (OSPF) (such as RIP, EIGRP, static routing, etc.), and the routing information of the external network is imported into the local network, such a router is called ASBR (Autonomous System Boundary) router).

Backbone Router: At least one interface of this type of router belongs to the backbone area. Therefore, all ABRs and internal routers located in Area0 are backbone routers.

image.png



4 network types supported in OSPF

1. Broadcast type (Broadcast)

2.NBMA type Non-Broadcast Multi-Access)

3. Point-to-Multipoint P2MP type (Point-to-Multipoint)

4. Point-to-point P2P type (point-to-point)

Link State LSA

OSPF is a routing protocol based on the link state. Compared with the RIP protocol that judges the hop count of the path through vectors, it pays more attention to the state of the path. The link state (LSA) is the description information on the OSPF interface, such as the IP address on the interface, subnet mask, network type, cost value, and so on. In an OSPF network, the router will send all its link status to neighbors without reservation. The neighbor will put all the received LSA information into the link state database, and then the neighbor will send it to the neighbor, and there will be no modification during the retransmission process. In this way, all OSPF routers in the network have the link state of the entire network, and the same network structure can be depicted through the link state.


Five types of OSPF data packets

1. Hello messages: sent periodically to discover and maintain OSPF neighbor relationships.

2. DD message: describes the summary information of the local LSDB (Link State Database), used for database synchronization between two devices.

3. LSR message: used to request the required LSA from the other party.

4. LSU message: used to send the LSA it needs to the other party.

5. LSAck message: used to confirm the received LSA.


The 7 states of the OSPF adjacency establishment process

1.down: There is no interaction between the two routers

2.Init: In this state, only hello messages can be exchanged without any other information

3. Two-way: After the hello message is exchanged, the two-way state is reached, and the neighbor relationship is established

4.Exstart: conduct master-slave relationship election to determine who sends DD packets first

5. Exchange: Exchange DD messages and establish their respective topology tables.

6. Loading: request routing information from the other party, exchange LSA, LSU, and LSACK packets

7.Full: Establish adjacency relationship and synchronize LSDB.

Neighbors and adjacencies

In OSPF, Neighbor and Adjacency are two different concepts.

After the OSPF router is started, it will send out Hello packets through the OSPF interface. The OSPF router that receives the Hello message will check the parameters defined in the message, and if the two parties agree, a neighbor relationship will be formed.

The two parties forming the neighbor relationship may not be able to form the neighbor relationship, which depends on the network type. Only when the two parties successfully exchange DD packets, exchange LSAs and achieve LSDB synchronization, can a true neighbor relationship be formed

OSPF establishment process

The OSPF establishment process can be simply divided into the following three processes

Establish neighbor relationship

Create their respective topology tables

Establish adjacency


Establish neighbor relationships.

The routers of both parties are initially in the down state. After connection, they enter the init state and start to exchange hello data packets with each other. After obtaining the basic information of the router through the hello message, they enter the two-way state and begin to establish a neighbor relationship. After the neighbor relationship is established, it enters the exstart state.

image.png

Create their respective topology tables

After entering the start state, the master-slave relationship is established, and after the LSA summary information is exchanged, it becomes the exchange state


Establish adjacency


The lsdb (link state database) is being synchronized, but the synchronization has not been completed. The relationship between the two devices is loading

Complete lsdb synchronization, enter the full state, and establish an adjacency relationship.

image.png

Guess you like

Origin blog.51cto.com/14841124/2664543