当前位置:网站首页>Data communication foundation OSPF Foundation
Data communication foundation OSPF Foundation
2022-07-05 15:36:00 【GALi_ two hundred and thirty-three】
OSPF agreement
Distance vector routing protocol
- Routers running distance vector routing protocols periodically flood their own routing tables .
- The router does not understand the topology of the entire network , It simply adds measurements 、 Only know where to get to a certain destination , How far away .
Link state routing protocol
LSAs The flood of
Router running link state routing protocol , What interacts with each other is not routing information , It is LSA( Link status notification ).
LSDB The maintenance of the
Each router will collect LSAs Put in your own LSDB( Link state database ) Store it . With LSDB, The router is equivalent to mastering the topology of the whole network .
SPF Calculation
Each router is based on LSDB, Use SPF( Shortest path algorithm ) Calculate , Get a self rooted 、 An acyclic tree covering the whole network .
Maintain routing tables
Each router is based on SPF Calculated results of , Load routes into the routing table .
OSPF brief introduction
Open shortest paths take precedence OSPF(Open Shortest Path First) Routing protocol is a typical link state (Link-state) The routing protocol of , It is generally used in the same routing domain . ad locum , A routing domain is an autonomous system (Autonomous System), namely AS, It refers to a group of networks that exchange routing information with each other through unified routing policies or routing protocols . In this AS in , be-all OSPF Routers all maintain the same description of this AS Structured database , The database stores the status information of the corresponding links in the routing domain ,OSPF It is through this database that the router calculates its OSPF Routing table .
Currently for IPv4 The protocol uses OSPF Version 2(RFC2328); in the light of IPv6 Agreement to use OSPF Version 3(RFC2740). Unless otherwise specified , In this article, we refer to OSPF Are all OSPF Version 2.
OSPF As a link state based protocol , To be able to solve RIP Many problems faced . Besides ,OSPF There are also the following advantages :
OSPF Adopt multicast (224.0.0.5,224.0.0.6) Send and receive protocol messages in the form , This can reduce the need for other non running OSPF The impact of routers .
OSPF Supports untyped inter domain routing (CIDR).
OSPF Support load sharing for equivalent routes .
OSPF Support message authentication .
OSPF Important concepts
AS
- AS( Autonomous systems ), It can also be called “ Routing domain ”(Routing Domain), It consists of a group of routers running the same routing protocol .
- same AS, All routers must allow the same routing protocol , And must be interconnected , The distribution is the same AS Number
- stay OSPF in , Only the same AS The routers in will interact with each other about link state information
- all OSPF Routers jointly maintain the same AS Structure description (AS The connection between regions )
Router-ID
OSPF Router-ID Used in OSPF domain It uniquely represents one OSPF Router , from OSPF From the perspective of network design , We ask for all OSPF Intra domain , It is forbidden that two routers have the same Router-ID.
OSPF Router-ID The setting of can be configured manually , Or through automatic protocol selection . Of course , In actual network deployment , Manual configuration is strongly recommended OSPF Of Router-ID, Because this is related to the stability of the agreement .
OSPF Cost
OSPF Use cost“ expenses ” As a routing metric .
OSPF Interface cost=100M / Interface bandwidth , among 100M by OSPF Reference bandwidth (reference-bandwidth), You can modify .
Each activation OSPF All interfaces have a cost value .
One OSPF The routing cost From the origin all the way to the local All incoming interfaces cost Summation of values .
- If the routing priority and overhead values learned from different interfaces are the same , Then join the routing table , Load sharing ; conversely , Choose the best .
DR、BDR
Broadcast multiple access network (Multi Access) in , The interfaces of all routers are the same network segment , These interfaces will be established in pairs OSPF Neighborhood , That means , Shared by the Internet :n(n-1)/2
So many OSPF Neighborhood , Maintaining so many neighborhoods does not only consume additional equipment resources , It also increases the network LSA The amount of flooding .
In order to reduce the in multi-channel access network OSPF Traffic ,OSPF Will be in every MA The Internet ( Multiple access to the network ) Elect a designated router (DR) And an alternate designated router (BDR).
DR Election rules : The highest OSPF The interface priority owner is selected as DR, If the priorities are equal ( The default is 1), Having the highest OSPF Router-ID Your router was elected DR, also DR Non preemptive .
Specify router (DR):DR Responsible for updating all other with this change information OSPF Router (DRother).
Standby designated router (BDR):BDR Will monitor DR The state of , And in the present DR Take over the role in case of failure .
Be careful OSPF by “ Interface sensitive protocol ”,DR And BDR Your status is based on OSPF Interface .
MA In the network , be-all DRother Routers are only connected to DR and BDR Establish adjacency ,DRother Do not establish full adjacency between .
In this way , The equipment in the multi-channel access network needs to be maintained OSPF Neighborhood relations have decreased significantly :M= (n-2)×2+1,LSA The flooding problem can also be alleviated to some extent .
LSA The flood of
Router R3 use 224.0.0.6 notice DR And BDR.
DR、BDR monitor 224.0.0.6 This multicast address .
DR To multicast address 224.0.0.5 Send updates to notify other routers .
be-all OSPF Router monitoring 224.0.0.5 This multicast address .
The router receives a message containing the changed LSA Of LSU after , Update your own LSDB, After a while (SPF Delay ), Execute on the updated link state database SPF Algorithm , Update the routing table if necessary .
Area
- One AS The interior can be divided into multiple areas (area)
- Every OSPF The router can only learn the complete link state information within its area
- OSPF The boundary of the area is the interface , Not a link , That is, the interfaces at both ends of the direct link can only belong to the same area
- And OSPF Different IS-IS The routing boundary of is the link
Problems in single region
LSA Flooding is serious ,OSPF The burden of routers is great .
The turbulence within the region will cause the router of the whole network SPF Calculation .
LSDB huge , Excessive consumption of resources , Equipment performance degradation , Affect data forwarding .
Every router needs to maintain a larger and larger routing table , Routes in a single region cannot be summarized .
OSPF Multi region
Less LSA The extent of flooding , Effectively control the topology change within the region , Achieve the goal of network optimization .
Route summary can be done at the regional boundary , The routing table is reduced .
make the best of OSPF Characteristics of special areas , Further reduce LSA flooding , So as to optimize the routing .
Multi region improves the scalability of the network , Conducive to the formation of large-scale networks .
Area0 It is the backbone area , It is responsible for transferring the link state notification information summarized by the regional boundary router between non backbone areas . To prevent loops ,OSPF It is required that all non backbone areas cannot be directly LSA Interaction , And must pass Area0 Transfer in the backbone area , Therefore, all non backbone areas must be connected with Area0“ Direct connection ”.
The role of the router
Regional routers Internal Router
Area border router ABR Area Border Router
Backbone router Backbone Router
AS Border router ASBR AS Boundary Router
OSPF Three tables of
Neighborhood watch (Peer table):
OSPF It is a reliable routing protocol , It is required to pass link status notification between routers , You need to establish OSPF Neighborhood ,hello The message is used to find other messages on the direct link OSPF Router , After a series of OSPF Message interaction finally establishes a fully adjacent neighbor relationship ,OSPF The neighbor information of the router is displayed in the neighbor table .
Link state database (Link-state database, abbreviation LSDB):
OSPF use LSA(link state Advertisement, Link status notification ) To describe network topology information , then OSPF Routers use LSDB To store these of the network LSA.OSPF What you produce and what your neighbors announce LSA Collect and store in LSDB in . master LSDB View and view LSA Only through in-depth analysis can we deeply understand OSPF.
OSPF Routing table (Routingtable):
be based on LSDB Conduct SPF(Dijkstra Algorithm ) Calculation , And the result is OSPF Routing table .
OSPF Message type
Message type | Message function |
---|---|
Hello message | Send periodically , To discover and maintain OSPF Neighborhood . |
DD message (Database Description packet) | Describe the local LSDB Summary information of , It is used for database synchronization between two devices . |
LSR message (Link State Request packet) | It is used to ask the other party for LSA. The device is only in OSPF The neighbors successfully exchanged DD The message will be sent to the other party LSR message . |
LSU message (Link State Update packet) | Used to send to the other party what it needs LSA. |
LSAck message (Link State Acknowledgment packet) | Used for receiving LSA Confirm . |
The establishment of neighborhood relations
Equipment adjacency relationship establishment process :
Neighbor discovery stage
First ,R1 stay ospf After the process starts , In multicast mode (224.0.0.5) Send to all directly connected neighbors hello message (10s). here R1 No neighborhood relationship has been established , therefore hello In the message Neighbor The field does not encapsulate any RouterID.
R2 received R1 Of hello After the message , Will receive R1 Of hello The interface of the message is converted to Init state , And from hello Get... In the message R1 Of RouterID, Add to neighbor table . stay DeadInterval Before failure ,R2 It will also be sent to all neighbors by multicast hello message , But in addition to encapsulating yourself RouterID,Neighber Fields are also encapsulated R1 Of RouterID.
(DeadInterval, Route expiration time , default 40s, I haven't received it at this interval , It is thought that this hello Packet routing failure )
R1 received R2 Of hello message , And found its own RouterID after , Will receive R2 Of hello The interface of the message is converted to 2-way state , meanwhile R1 And I got it R2 Of RouterID. stay DeadInterval Before failure , Send carry neighbors RouterID Of hello message .Neighber Fields are encapsulated R2 Of RouterID.
When R2 To receive R1 Message of , And found its own RouterID after , Will receive R1 Of hello The interface of the message is converted to 2-way state , such R1 and R2 Establish a neighbor relationship .
The establishment stage of master-slave relationship
Both sides have established 2-way Post state ,R1 and R2 All through the previously obtained hello The message goes on DR、BDR The election , After the election, both sides enter ExStart state .DR、BDR It is through router priority and RouterID Elected , And only hello In the message Rtr Pri( priority ) Greater than 0 Router is qualified to vote . The election process is as follows :
After two-way communication is established , The local route will check the messages sent by each neighbor hello Priority in package 、DR、BDR Domain . here , Every router claims to be DR、BDR( The interface addresses are placed in hello Bag DR、BDR Field ).
By comparison hello In bag DR The field with the highest priority is DR,BDR The field with the highest priority is BDR.DR\BDR The election of The higher the priority, the higher the priority , If the priorities are equal , On the comparison RouterID, Similarly, the bigger the priority .
If no router is selected BDR, Then the non with the highest priority DR The router is chosen BDR, Equal priority , On the comparison RouterID.
Get into ExStart Post state , Both sides began with DD Message interaction , Determine the master-slave relationship , Determine the data interaction DD Message initial serial number , To ensure that the latest link state information is received .
At the beginning of the interaction , Both sides are 【M/S Field set to 1( Represent yourself as the main equipment ), stay DD Sequence Number Plus all kinds of current DD The sequence number of the message ( Send each time +1),LSA Header It's empty 】 Of DD Message interaction , Finally, according to RouterID Determine the master and slave ,RouterID Large main equipment ( The assumption is R2)
After determining the master-slave relationship ,R1 Take the main equipment R2 The serial number of the message sent to the master device R2 send out DD message ,M/S Set as 0( Represent yourself as a slave ), Again LSA Header It's empty , and Will receive DD The interface of the message is changed to Exchange state . Main equipment R2 Receive slave R1 Of DD Message also Will receive DD The interface of the message is changed to Exchange state , Then enter the database synchronization phase .
Database synchronization phase
Main equipment R2 Start moving to slave devices R1 send out with LSA Header Field DD message ( The first DD Of I Field is 1, Stands for continuous DD The first in the message , rest DD message I Field is 0),M Field is 1( There is a message after the representative ) Yes R1 Update the database . Send each time DD message , Serial number +1. Slave device R1 Received every time DD Respond with message serial number ( but LSA Header It's empty )
When the main equipment R2 The master device sends the last DD message , take M The field is set to 0, meanwhile LSA Header It's empty , and Will receive DD The interface of the message is changed to Loading state . Slave device R1 Know this is the last DD After the message , Will also receive DD The interface of the message is changed to Loading state .
When the main equipment R2 Finished sending DD After the message , Slave device R1 Start based on received DD The message LSA Header Fields check their LSDB. If you find some LSA Not in my own LSDB in , Slave device R1 Will report to the main equipment R2 send out LSR Request an update . Main equipment R2 send out LSU Give updated information ,R1 After receipt of , Respond LSAck Confirm .
notes : Both parties may have something that the other party does not LSA, So in DD The master-slave relationship is not fixed during interaction , Both parties can send LSR message .
Complete adjacency stage
When both sides LSDB After full synchronization , Both parties turn to Full state , This establishes adjacency .
OSPF Network type
OSPF Supported network types
Point to point networks
Broadcast multiple access network
Non broadcast multiple access (NBMA) network
P2MP The Internet
Default network type corresponding to common link layer protocol
Network type | Common link layer protocols |
---|---|
Point-to-point | PPP link ;Lapb link ;HDLC link ; |
Broadcast | Ethernet link ; |
NBMA | Frame Relay link ;ATM link |
P2MP | It needs to be specified by hand |
OSPF The basic configuration of
establish OSPF process , And designate OSPF Process number and Router-ID:
[Router] ospf [ process-id | router-id router-id ]
Enter specific area Configuration view of :
[Router-ospf] area area-id
In specific area In the configuration view of , Activate at a specific interface OSPF:
[Router-ospf-area] network ip-address wildcard-mask
see OSPF Protocol related operating parameters
display ospf brief
see OSPF Neighborhood watch
display ospf peer
see LSDB surface
display ospf lsdb
see OSPF route
display ospf routing
Interface GigabitEthernet0/0/1
ospf cost 9 # modify OSPF cost
ospf dr-priority 255 # modify dr priority
OSPF Process number (Processor ID)
OSPF The value range of the process number is 1-65535, Local significance only , Used to identify on a network device OSPF process . Huawei's network products support running multiple OSPF process , every last OSPF Processes need to be distinguished by specifying a specific process number .
Because the process number only has local meaning , So two directly connected devices , If you want to create OSPF Adjacency relations , They are not required to use the same process number .
Wildcard Mask Wildcard-mask
Wildcard is a 32 The value of the bit length , Used to indicate IP In the address , Which bits need to be strictly matched , It doesn't matter which bits .
Wildcards are usually expressed in dotted decimal form similar to netmask , But the meaning is completely different from netmask .
Network mask | wildcard |
---|---|
for example 255.255.255.0 | for example 0.0.0.255 |
Used to indicate IP In the address , Which bits are part of the network , What is the host part . | Used to indicate IP In the address , Which bits need to be strictly matched , It doesn't matter which bits . |
In the netmask 1 The bit of represents the network part . | Wildcards are 1 The bit of indicates that no match is required . |
In the netmask 0 The bit of indicates the host part . | Wildcards are 0 The bit representation of must be strictly matched . |
Single area OSPF
To configure :
[AR1]ospf 1 router-id 1.1.1.1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[AR2]ospf 1 router-id 2.2.2.2
[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255
[AR2]ospf 1 router-id 3.3.3.3
[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
View neighbor information
Check the learned route
Multi region OSPF
To configure :
[AR1]ospf 1 router-id 1.1.1.1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255
[AR2]ospf 1 router-id 2.2.2.2
[AR2-ospf-1]area 0 # area 0
[AR2-ospf-1-area-0.0.0.0]net
[AR2-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]area 1 # area 1
[AR2-ospf-1-area-0.0.0.1]network 192.168.23.0 0.0.0.255
[AR3]ospf 1 router-id 3.3.3.3
[AR3-ospf-1]area 1
[AR3-ospf-1-area-0.0.0.1]network 192.168.23.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255
View routing table
边栏推荐
- P6183 [USACO10MAR] The Rock Game S
- Calculate weight and comprehensive score by R entropy weight method
- mapper. Comments in XML files
- sql server char nchar varchar和nvarchar的区别
- 你童年的快乐,都是被它承包了
- I spring web upload
- ionic cordova项目修改插件
- Bugku's Ping
- "Sequelae" of the withdrawal of community group purchase from the city
- Analytic hierarchy process of mathematical modeling (including Matlab code)
猜你喜欢
Xiao Sha's arithmetic problem solving Report
Thymeleaf uses background custom tool classes to process text
Codasip为RISC-V处理器系列增加Veridify安全启动功能
1330: [example 8.3] minimum steps
Example of lvgl display picture
Crud de MySQL
JS knowledge points-01
No one consults when doing research and does not communicate with students. UNC assistant professor has a two-year history of teaching struggle
Bugku easy_ nbt
Bugku telnet
随机推荐
Go learning ----- relevant knowledge of JWT
"Sequelae" of the withdrawal of community group purchase from the city
Write a go program with vscode in one article
Install PHP extension spoole
PHP high concurrency and large traffic solution (PHP interview theory question)
Your childhood happiness was contracted by it
Aike AI frontier promotion (7.5)
F. Weights assignment for tree edges problem solving Report
Detailed explanation of C language branch statements
Detailed explanation of QT creator breakpoint debugger
数据库学习——数据库安全性
Redis distributed lock principle and its implementation with PHP (2)
Number protection AXB function! (essence)
Hongmeng system -- Analysis from the perspective of business
Creation and optimization of MySQL index
复现Thinkphp 2.x 任意代码执行漏洞
The difference between abstract classes and interfaces in PHP (PHP interview theory question)
Database learning - Database Security
What are CSRF, XSS, SQL injection, DDoS attack and timing attack respectively and how to prevent them (PHP interview theory question)
Summary of the third class