The most detailed OSPF routing protocol introduction

一、OSPF

1.1 OSPF attributes

The interior gateway protocol
belongs to the IP protocol, and the protocol number is 89.
The multicast address of DRother is 224.0.0.5 and the multicast address of
DR/BDR is 224.0.0.6

1.2 OSPF divides networks into four types

Point-to-Point
network (Broadcast MultiAcess BMA)
non-broadcast multi-access network (None Broadcast MultiAcess NBMA)
Point-to-Multipoint network

1.3 OSPF working process

Insert picture description here

1.4 The three tables of OSPF

1. Neighbor list;
2. Link state database;
3. Routing table.

1.5 OSPF neighbor state machine

Insert picture description here

1.6 Conditions for OSPF to establish neighbors

Router-ID must not be the same
2, Hello time must be the same
, Dead time must be the same,
4, area ID must be the same,
5, authentication must be the same
6, STUB flag bit must be the same (the special area of ​​directly connected routers must be the same)
7, three MTU is not Matching cannot form an adjacency relationship. (One side is Exstart, the other side is Exchange)
8. The OSPF version number is different (the current version is 2)
9. When the OSPF network type is MA, the mask must be the same (two neighbors). Therefore, DR and LSA-2 will appear. The network segment cannot be described

2. OSPF area

To adapt to large-scale networks, OSPF divides multiple areas within the AS.
Each OSPF router only maintains the complete link state information of the area in which it is located.
Area: The area ID can represent a decimal number or an IP.

2.1 OSPF area division

Insert picture description here
Area0: Backbone area
Area1, Area2: Non-backbone areas, the non-backbone areas are divided into standard areas and special areas

2.1.1 OSPF special area type, use occasion, function and generated default route

Insert picture description here

Three, OSPF router

3.1 Classification of routers

Insert picture description here

3.2 Router ID

3.2.1 Function

The address that uniquely identifies the router in the OSPF area

3.2.2 Router ID selection rules

You can use the router-id command to specify the router id to
select the IP address with the highest router loop back connection value.
If there is no loop back interface, select the highest IP address among the physical ports

3.2.3 How OSPF sets the Router ID

1. Effective to the whole world:

[R1]router-id 1.1.1.1 

2. Only valid in OSPF:

[R1]OSPF 1 router-id 1.1.1.1

3.3 DR and BDR

Other routers only form an adjacent relationship with DR and BDR.
Each network segment elects a DR and BDR.

3.3.1 Election method of DR and BDR

Automatic election of DR and BDR

The router with the largest router id on the network segment will be elected as the DR, and the second largest router will be elected as the BDR

Manual election of DR and BDR

The priority range is 0-255. The larger the value, the higher the priority. The default value is 1.
If the priority is the same, you need to compare the router value.
If the router priority is set to 0, it will not participate in DR and BDR elections.

3.3.2 DR and BDR election process

The priority of the router can affect an election process. The election has been completed, but it cannot force the replacement of existing DR and BDR routers.

Four, data transmission in OSPF

4.1 Three types of OSPF traffic

Insert picture description here

4.2 OSPF packet types and functions

Insert picture description here

4.3 LSA

LSA (Link State Broadcast) is a packet used by the link state protocol, which includes information about neighbors and channel costs. LSAs are received by routers to maintain their routing tables.

4.3.1 Types of LSA

Insert picture description here

4.3.2 Commands for viewing various LSAs

Insert picture description here

Five, OSPF multi-area

5.1 Reasons for OSPF multi-area generation

Improve network scalability and
fast convergence

5.2 Virtual link

5.2.1 Use occasion

Used when a non-backbone area spans a non-backbone area

5.2.2 Function

Help this non-backbone area get a complete lsdb

5.2.3 Command

 [R1] ospf
 [R1]area1
 [R1]vlink-peer 对端router-id
 对端路由器在相同区域设置同样的命令

5.2.4 Note

The virtual link can only help a non-backbone area to cross the non-backbone area, and the virtual link belongs to area 0

5.3 Redistribution

5.3.1 Redistribution of OSPF and RIP

Need to be entered in ASBR

ospf 1
import-route rip 1 cost 10
rip 1
import-route ospf 1 cost 0

5.3.2 Send default route

Deliver default routes in ospf to other ospf neighbors

 default-route-advertise always cost 0

Distribute the default route in rip to other rip neighbors

default-route originate cost 0

Six, OSPF and RIP comparison

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_50344820/article/details/109126266