当前位置:网站首页>OSPF --- open shortest priority path protocol
OSPF --- open shortest priority path protocol
2022-07-25 17:37:00 【Mountains and rivers far away, fireworks on earth】
Dynamic routing protocol : Start a protocol between routers , Then the routers communicate with each other , Learn from each other and calculate to obtain the path of the previously unknown target network segment ;
RIP OSPF EIGRP BGP ISIS
classification :
be based on AS To classify
AS- Autonomous systems standard 16 Bit binary 0-65535 among 1-64511 public 64512-65535 private
Expand 32 Bit binary
AS Run within —IGP agreement – Internal Gateway Routing Protocol -- RIP/OSPF/ISIS/EIGRP
AS Running between —EGP agreement - External gateway routing protocol -- EGP/BGP
IGP Classification of protocols :
【1】 Based on whether the subnet mask is carried during update --- There are categories ( No ) No category ( carry )
【2】 Classification based on work characteristics
- Distance vector -DV RIP/EIGRP Directly share the routing table – Learn routing items directly Small update volume
- Link state -LS OSPF/ISIS Share topology information -- Calculate routing entries locally A lot of updates
OSPF: Open shortest path first protocol Classless link state routing protocol
The public agreement ; Cross layer encapsulation to IP Headlines , Agreement No 89; Multicast update :224.0.0.5 224.0.0.6
Trigger update 、 Cycle update (30min);
Need structured deployment : Zoning Address planning
One 、OSPF Protocol packets :
- Packet structure

- Packet type

Hello: For neighbors 、 Adjacency Find out 、 establish 、 Keep alive hello time Default 10s or 30s
DBD: Database description package
LSR: Link status request
LSU: Link status update
LSack: Link status confirmation
Two 、 state
Down: Once sent locally hello The package goes to the next state
Init: initialization received hello If the package exists locally RID Go to the next state
2way: Two way communication A sign of neighborhood building
Matching conditions : The point-to-point network will directly enter the next state ; MA The network type will be DR/BDR The election , Not DR/BDR You will not be able to enter the next state ;
Exstart: Pre start Use similar hello Of DBD Conduct the election of master-slave relationship ,RID Big priority is preferred to enter the next state
Exchange Quasi exchange Use the real DBD Share the database directory , Need to use ACK confirm
Loading load Use LSR/LSU/LSAck To get the unknown LSA Information ;
Full forward A sign of the establishment of adjacency



LSA: Link status notification , Under different network conditions, different types of LSA Information to represent topology or routing entries ;
LSDB: Link state database Load and store all kinds of LSA;
3、 ... and 、OSPF Working process of
OSPF After the agreement is started ,A Started to all local OSPF Direct interface multicast protocol 224.00.5 send out hello package ; Local hello The package carries the only one in the whole network router-id;
Router id effect : Identify the router
Then the opposite end B function OSPF The agreed device will reply hello package , The hello If you carry A Of router id, that A/B Establish a relationship as a neighbor ; Generate Neighborhood watch
After the neighbor relationship is established , Conditional matching between neighbors , If the match fails, it will stay in the neighborhood , only hello Keep the package cycle alive ;
If the condition matching is successful, the adjacency relationship can be established :
Adjacency sharing DBD package , Local and adjacent DBD Compare packages , Find a file that does not exist locally LSA Information directory ;
Then use LSR To ask , End to end use LSU Answer specific LSA Information , Then use it locally ack confirm , reliable ;
When the process is complete , Generate Database table ;
Then, based on the local database table , Enable SPF Route selection rules , Calculate the shortest path to all unknown network segments , Then add it to the local Routing table in ; Convergence complete ,hello Keep the package cycle alive , Every time 30min Send and receive again DBD To determine whether the database is consistent with the adjacent database ;
Structural mutation :
- New network segment Equipment directly connected to the new network segment , Will be used directly LSU Package to inform all local neighbors , Then, adjacency transmission and adjacency diffusion will spread to the whole network , need ACK confirm
- Disconnect the network segment Equipment directly connected to the disconnected network segment , Will be used directly LSU Package to inform all local neighbors , Then, adjacency transmission and adjacency diffusion will spread to the whole network , need ACK confirm
- Unable to communicate dead time by hello time Of 4 times ; When dead time To the hour , Break the neighborhood , Delete the route entry generated by this adjacency ;
Four 、OSPF The basic configuration of
[r1]ospf 1 router-id 1.1.1.1 Startup time , The process number needs to be defined ; The process number is only locally unique ; It is recommended to configure the only in the whole network at the same time router-id; Generation order — manual Maximum in local loopback interface ip Address value The maximum value in the local physical interface ip Address
[r1-ospf-1]
Declare :ospf When the agreement is announced, it needs to be divided into regions
Regional division rules :
1、 Star topology , Area 0 For the central backbone area , Others are greater than 0 It is a non backbone site area ;
2、 Must have ABR-- Area border router
[r2-ospf-1]area 0 Enter the area first , Then declare the interface belonging to the region in the region , The declaration must carry an inverse mask
[r2-ospf-1-area-0.0.0.0]network 12.1.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]q
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 23.1.1.1 0.0.0.0
After the startup configuration is completed , Sending and receiving between neighbors hello package , Build a neighborhood ; Generate Neighborhood watch :
[r2]display ospf peer
[r2]display ospf peer brief
neighbor 、 The discovery of adjacency 、 establish 、 Survival depends on hello Package progress ;
Hello The parameters that must be completely consistent between neighbors in the packet : Any parameter is different , All lead to the failure to establish neighbor relations ()
- Subnet mask ( Huawei ) send out hello Source of package interface ip Address mask
- Hello dead time -- OSPF The interface is related to the network type
- Authentication field -- Update security
- Area ID -- It is required that there be... Between areas ABR
5、 Terminal area markers -- Special area

After the neighbor relationship is established , Conditional matching between neighbors , Successful matching can be established as adjacency ; Adjacency relationships will use DBD Package for master-slave relationship election , Then the master gives priority to DBD Share database directory information , Thus ultimately based on LSR/LSU/LSAck To get the unknown LSA Information ; When the whole network is collected LSA After the message , Loaded locally LSDB( Link state database )-- database surface :
<r2>display ospf lsdb
<r1>reset ospf process
Warning: The OSPF process will be reset. Continue? [Y/N]:y
About OSPF,DBD Several knowledge points of the package :
1、DBD Carry... In your bag MTU value , Ask neighbors MTU Values must be the same , Otherwise it will get stuck in exstart or exchange state ;
Huawei is not enabled by default MTU testing
[r1]interface GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ospf mtu-enable
2、 Implicit confirmation — Do not use confirmation package , Instead, the serial number of the master device is copied from the device to confirm the receipt of the master DBD
- OSPF Marker bit I M MS I by 1 The first one sent locally DBD package
M by 0, Represents the last... Issued locally DBD; MS by 1 On behalf of the Lord , by 0 For from ;
After the database is established , Local based on SPF Route selection rules , Calculate the shortest path to the unknown network segment and load it on Routing table in ;
- Letter
Cisco
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
O In the same area , Calculated by local topology
O IA Inter domain routing ,ABR The route calculated through the topology of other regions , Then share to another area ; Local area, another area
O E1/2 Extraterritorial routing After other agreements or other processes are produced , adopt ASBR Republish to OSPF agreement
ON1/2 NSSA Extraterritorial routing After other agreements or other processes are produced , adopt ASBR Republish to OSPF agreement , At the same time, the device learning this route is in ospf A kind of NSSA In a special area of
<r1>display ospf routing
- Measure (cost)
Cost value Reference bandwidth / Interface bandwidth Huawei equipment , The loopback interface is not calculated as a path ; The default reference bandwidth is 1000M;
optimization cost The minimum path of the sum of values ;
5、 ... and 、 OSPF The condition that a protocol neighbor becomes an adjacency relationship
In a point-to-point network , be-all OSPF Neighbors will be directly established as adjacency ;
stay MA In the network , To avoid a lot of repetition LSA to update — because OSPF It needs to be carried out between adjacent rooms DBD contrast , Therefore, there is no interface water partition mechanism ; So it must be carried out DR/BDR The election , Not DR/BDR Only establish a neighbor relationship between ;--- In every one of them MA There needs to be an election in the network ;
Election rules :
- priority The value is excellent , The default is 1; if 0 To abandon the election ;
- Same priority , Compare the performance of all the equipment of the candidate interface router-id, The value is excellent ;
[r1-GigabitEthernet0/0/1]ospf dr-priority 2
Modify the priority of the selected interface
Bear in mind :DR Election non preemption , Therefore, after modifying the priority , The candidate equipment must be restarted ospf Process to re-election
OSPF The convergence of is called LSA flooding , Also known as LSDB Sync ;
- OSPF Interface network type –OSPF The protocol works under different network types of interfaces , Its different ways of working
Interface network type OSPF Interface network type (ospf Operation mode )
LoopBack 0. Cisco – LoopBack No, hello package With 32 Bit host routing
Huawei — Is shown as p2p type For the actual LoopBack Operation mode
Point to point
( String line HDLC/PPP/GRE) p2p. hello time10s Automatic neighbor building No election DR/BDR
BMA
Ethernet Broadcast hello time 10s Automatic neighbor building choose DR/BDR
NBMA
Frame relay nbma hello time 30s Create neighbors manually choose DR/BDR
MGRE p2p. hello time10s Automatic neighbor building No election DR/BDR – In a network segment, only
There can be a neighbor ; Huawei equipment is in a MGRE Network segment , The interface is point-to-point
When working in a way , Only and first received hello Establish a neighbor relationship with your device ;
Cisco In this case, there will be a tumbling of neighbors ;
notes : stay MGRE Environment , The interface defaults to ospf The working mode is point-to-point , This cannot be achieved in this way NBMA All the neighbors of the network segment are connected ; Therefore, you can only modify the working mode of the interface :
modify MGRE Network segment All interfaces by Broadcast Operation mode , Remember that if some interfaces are modified to Broadcast, The other part of the interface remains point-to-point , because hello time The same can establish neighbors , But the working mechanism is DR/BDR The electoral office is different , Therefore, the network segment cannot converge normally ;
- meanwhile , We must pay attention to the network topology ; If the network segment is a fully connected mesh structure , that DR The election will proceed normally ; But in case of partial mesh or center to site topology , Will be possible DR Wrong location problem ;
- If the network topology can only be partial mesh or center to site , Manual intervention is required DR Location
Or change the working mode of all interfaces to point to multipoint working mode ;
Ospf Point to multipoint working mode : It can only be configured manually , It is applicable to some mesh topology ;
Hello time30s, No election DR/BDR, Automatically build neighborhood relationships ;
6、 ... and 、OSPF Irregular areas of
a ABR If the equipment is not connected to the backbone area 0, By default, inter region routing cannot be shared
- Away from the non backbone area of the backbone
- Discontinuous backbone
Solution :
- Between legal and illegal ABR On the establishment of tunnel, Then announce it to ospf Agreement
shortcoming :1、 Cycle update 、 Keep alive , Trigger the update to occupy resources in the intermediate crossing area
- Poor route selection -- When ospf Learn two common goals , But when different areas come at the same time , The backbone area is preferred ;
Tunnel Areas should be declared in the same area
- Virtual link --- Between legal and illegal ABR Establish virtual link on , By legal ABR Illegal ABR To authorize ;
Make illegal ABR You can share routes between regions ;
Because there is no new path , Therefore, there is no problem of poor route selection ;
[r2-ospf-1]area 1 Two sets of ABR Common area
[r2-ospf-1-area-0.0.0.1]vlink-peer 4.4.4.4 Opposite end ABR Of RID
Cisco In order to avoid the occupation of the intermediate area by periodic information , Cancel all periodic behaviors on the virtual chain ;--- unreliable
Huawei still keeps the cycle alive on the virtual chain 、 to update --- Resource occupation in the middle area
- Multi process bidirectional republication ( recommend )
Multi process --- On the same device , Different processes can work on different interfaces , Build their own neighborhood , Generate their own databases ( Do not share ); Only the routes calculated by them are loaded into the same routing table ; An interface can only be declared by one process ;
Two way republication ,ASBR( Autonomous system border router 、 Protocol boundary router ), Two way sharing of routes generated by different processes or protocols ;
[r2]ospf 1
[r2-ospf-1]import-route ospf 2
[r2-ospf-1]q
[r2]ospf 2
[r2-ospf-2]import-route ospf 1
- OSPF Various LSA --- Database table
<r1>display ospf lsdb
<r1>display ospf lsdb router 1.1.1.1
Class alias link-id( The number in the catalog )
All categories of LSA, All carry the following information
Type : Router Class alias Here is 1 class
Ls id : 1.1.1.1 link-id The number in the catalog
Adv rtr : 1.1.1.1 Notifier --- The LSA Of the update source device RID
Ls age : 1359 Aging time 1800s The cycle is refreshed to 0 Trigger update return 0 Maximum 3609s
Len : 48
Options : E
seq# : 8000000c Serial number
chksum : 0x818c Check code
OSPF Of LSA yes 1800 It will be updated once, and the serial number will be added once
LSA A comparison between the old and the new
1、 Will compare the serial numbers first , The larger the serial number, the better ,
2、 If the serial numbers are the same , Will compare the check values (checksum) The bigger the better
3、 If the check value is the same , Will compare LSA Age Time , Is it equal to MAX-age Time (3600)
4、 If age Time is not equal to max-age Time , Will compare their differences , If the difference is large 15 minute (900 second ), The small ones are excellent
5、 If age Time is not equal to max-age Time , Will compare their differences , If the difference is less than 15 minute , The explanation is the same LSA, Ignore one of them
Under what circumstances LSA Will update :
1、1800 The expiration date will be updated periodically
2、 Trigger update ( Interface address change ( increase , Or delete ), Modify the interface cost value , Delete interface , Or delete the announcement )
Class alias The scope of communication Notifier The information carried
1 class LSA-router Within the region Each router in this area The direct connection topology of each device in this area
2 class LSA-Network Within the region Of this network segment DR Topology of the network segment
3 class LSA-summary Whole OSPF Domain ABR O IA Inter domain routing
4 class LSA-asbr except ASBR Outside the area ABR ASBR The location of
Whole ospf Domain ;ASBR Use... In your area
1 Class tag location
5 class LSA-ase Whole OSPF Domain ASBR O E Extraterritorial routing
7 class LSA-nssa A single NSSA In the area ASBR O N Extraterritorial routing
Class alias link-id Notifier
1 class LSA-router Announcer's RID Each router in this area
2 class LSA-Network DR Interface ip Address Every MA In a segment DR
3 class LSA-summary Target network number of inter domain routing ABR, After passing the next station ABR when , Change to new ABR
4 class LSA-asbr ASBR Of RID ABR, After passing the next station ABR when , Change to new ABR
5 class LSA-ase The target network number of the extraterritorial route ASBR stay ospf Internal transfer does not change
7 class LSA-nssa The target network number of the extraterritorial route ASBR
边栏推荐
- 栈的顺序存储结构,链式存储结构及实现
- 什么是 IP SSL 证书,如何申请?
- EasyUI modification and DataGrid dialog form control use
- 枚举类和魔术值
- Lvgl 7.11 tileview interface cycle switching
- Go language series: where does go come from and where will go?
- EDI 对接CommerceHub OrderStream
- OSPF---开放式最短优先路径协议
- Ultimate doll 2.0 | cloud native delivery package
- Virtual memory management
猜你喜欢

Redis源码与设计剖析 -- 17.Redis事件处理

面试官:说说 log.Fatal 和 panic 的区别

Three dimensional function display of gray image

Technical difficulties and applications of large humanoid robots

Text translation software - text batch translation converter free of charge
![[knowledge atlas] practice -- Practice of question answering system based on medical knowledge atlas (Part4): problem analysis and retrieval sentence generation combined with problem classification](/img/22/01297d28e5bfb105fc65ee29248a7c.png)
[knowledge atlas] practice -- Practice of question answering system based on medical knowledge atlas (Part4): problem analysis and retrieval sentence generation combined with problem classification

自动化测试 PO设计模型

大型仿人机器人的技术难点和应用情况

An article about ultrasonic humidifier

EasyUI drop-down box, add and put on and off shelves of products
随机推荐
Google Earth engine - download the globalmlbuildingfootprints vector collection of global buildings
生成扩散模型漫谈:DDPM = 贝叶斯 + 去噪
交友活动记录
Enumeration classes and magic values
Redis源码与设计剖析 -- 17.Redis事件处理
8 年产品经验,我总结了这些持续高效研发实践经验 · 研发篇
[solution] the Microsoft edge browser has the problem of "unable to access this page"
Does PgSQL have a useful graphical management tool?
I2C通信——时序图
枚举类和魔术值
OSPF综合实验
03. Longest substring without repeated characters
Redis源码与设计剖析 -- 18.Redis网络连接库分析
An article about ultrasonic humidifier
Is there a method in PostgreSQL that only compiles statements but does not execute them?
带你初步了解多方安全计算(MPC)
Add batch delete
「数字安全」警惕 NFT的七大骗局
Chapter V: process control
EasyUI drop-down box, add and put on and off shelves of products