OSPF basic, easy to understand

OSPF

mind Mapping

· OSPF basic concepts
· OSPF working process
· OSPF message
· OSPF neighbor establishment process
· DR, BDR election
· LSA analysis
· OSPF area type
· OSPF network type
· OSPF path selection
· OSPF special characteristics and example analysis

1. The basic concept of OSPF

OSPF (Open shortest path first) is a link-state protocol based on SPF algorithm. OSPF is a hierarchical protocol. It does not advertise routing items to neighbors. It advertises link state information to neighbors. Each router calculates and generates a routing table according to the link state database.

2. The working process of OSPF

1. Understand the directly connected network : correctly configure the IP address and subnet mask of the interface and activate the interface, and include the interface in a network statement
2. Send a HELLO packet : establish an OSPF neighbor relationship: a neighbor refers to the same interface on the link OSPF-enabled router
3. Establish link state packet : It contains various states of the link directly connected to the router, including neighbor ID, link type and bandwidth. Once a critical relationship is established, an LSP can be created
4. Flood the link-state packets to neighbors : each router floods the LSPs in its own library to neighbor routers until all OSPF routers in the area have the same LSDB (Link state database)
5. Create its own routing table : routers use the SPF algorithm according to the link state database to create their own routing tables

Three. OSPF message

1. OSPF
OSPF message format
packet 2.
OSPF packets There are five types of packets in OSPF, which play an important role in the entire OSFP operation process
· HELLO package
· DBD package
· LSR package
· LSU package
· LSACK
package
establish neighbor relations, to negotiate neighbor relations based on the contents of the package: the role of
the field to establish neighbor relations need to match: HELLO and failure interval, the same area code, area distal logo
appears phases: establishment phase neighbors
Insert picture description here

(2) The
role of the DBD package (Datebase Description) : After the establishment of the OSPF neighbor relationship, the DBD package is responsible for describing the local LSDB. After receiving the comparison of the router and its own LSDB, the LSDB
special fields in the area are synchronized :
1 field, set 1 indicates that this is the
M field of the first data packet to be sent . Set to 1 indicates that there will be a DD packet to be sent after the
MS field, used to indicate who is the master (Master) and slave (Slave)
DD Sequence Number: use the sequence number To ensure the integrity and reliability of transmission
LSA Headers: LSA header summary information
Insert picture description here
(3) LSR packet (Link-State Update)
role: used to request some missing routes from neighbor routers, or which LSAs have been missing
Special fields:
LS Type, specify the requested LSA type, a total of 7 types of
Link State ID: used to indicate LSA, according to the different types of LSA, has different meanings
Advertising Router: used to indicate the generation of this LSA router ID
Insert picture description here
(4) LSU ( Link-State Update)
function: respond to the LSR, or periodically send LSU to update the LSDB in the area, the content of the LSA that is really needed is sent
Special field function:
Nu mber of LSA, specify the total number of
LSAs sent in this message LSAs: a piece of specific LSA complete information, there can be multiple LSA information
Insert picture description here
(5) ACK packet
Function: Used to confirm the message returned after receiving the LSU from the opposite end, the content is the LSA header that needs to be confirmed
Special fields:
1.LSA Headres: LAS header information
Insert picture description here

Four. OSPF neighbor establishment process

First, the neighbor relationship and the abutting relationship to be distinguished from each other state between the two routers is a 2-way neighbor relationship indicates that, when the neighbor relationship bit indicates FULL establish adjacency
1. neighbor relationship change process
down-> init-> 2-way-> exstart-> exchange-> loading-> full
down: indicates that the neighbor relationship has not been established, the existence of the neighbor is not detected
init: the HELLO packet is received, but the neighbor information in the packet is not Own router ID
2-way: received the HELLO packet, the neighbor information in the packet contains its own router ID
exstart: indicates that the master-slave relationship is being negotiated, that is, who sends the DBD
exchange first : under the leadership of the master router, start to exchange DBD
loading : Request more detailed information, that is, exchange LSU
full: indicates that the adjacency relationship has been completely established, and the database is completely consistent with the neighbor

2. Detailed process of neighbor establishment
(1) Neighbor establishment process (down-> init-> 2-way)
Multi-access link, OSPF first determines DR and BDR, which can optimize the information exchange process in the broadcast network, in 2 -DR and BDR elections will be conducted after -way

(2) The process of exchanging LSDB (exstart-> exchange)
Before exchanging LSDB, the router will elect a master router to dominate the entire exchange phase, and determine that the master router is in the exstart phase
exstart: First, the routers on a link are initially Think of yourself as the master router and send empty DBD packets (without LSA index, including RID, MS bit, M bit, 1 bit will all be set to 1). After receiving the empty DBD from the peer, it will compare the RID, the larger end Will become the master router, the slave router also needs to send a DBD packet to respond to the master router. At this point, it enters the exchange stage
exchange: under the leadership of the main router began to exchange LSDB. The DBD packet sent by the master router always responds from the slave router. The DBD packets sent from the router are all responses to the DBD packets sent by the master router. If the master router has no information to pass and the slave router still has it, the slave router will set M to 1, so that the master router knows the slave The router still has information to send, it will continue to send DBD packets to the slave router, and the slave router can send related information

(3) Synchronous link state database process (Loading-> Full) After the
DBD exchange is completed, the router has an index list of neighbor LSAs. The router enters the Loading state and begins to request LSAs that it does not have. The router sends an LSR to request For multiple LSAs, the opposite end replies to the LSU packet to tell the router that he wants the information. You can use LSACK to confirm that the opposite end has received the LSU. When both ends no longer send LSU and LSR, the LSDB is synchronized and enters the FULLL state

V. DR and BDR elections

1. The significance of the existence of
DR and BDR DR and BDR exist in multiple access, the role is to reduce the number of synchronization in the area, reduce the router memory consumption, reduce routing traffic updates, ensure that the same area has the same DR and BDR

2. Election process The election process of
DR and BDR is non-preemptive. The
priority is higher. The one with higher priority will be elected as DR and BDR. If the priority is the same, then look at the RID. The RID will win, if the priority is 0, Means that DR and BDR elections are not conducted.
Non-DR and BDR, the multicast used when sending to DR and BDR is 224.0.0.6, and DR and BDR are sent to non-DR and BDR using multicast 224.0.0.5

6. LSA

1. The basic concept of
LSA LSA is a data structure established by routers to describe link state information, stored in LSDB, carried in LSU, and describes the state of the link or interface and the cost of each link

2. The latest LSA judgment rules
· Higher serial number
· Checksum, the bigger the newer
· Aging time
· Smaller LS age

3.
LSA Type Type 1: Router LSA (Router Link States)
Link-state ID: Source Router ID
Advertisement Router: OSPF Router
Advertisement Scope: Only Flood in Specific Area
Advertisement Content:
· The interfaces and interface locations of the router in the area Connected neighbors (link cost, etc.), router direct link state
, network connection type
, whether it is ABR
Insert picture description here
Insert picture description here
type 2: Network LSA (NET Link-State)
link state ID: IP interface address of
DR Advertise router: DR
Announcement range of BDR and BDR : Flooding in a specific area, the
announcement content will only appear in the network of DR and BDR : the announcement is a transmission subnet, which lists all the routers that constitute the transit network, including the link Subnet mask, link state and other information (that is, all routers associated with DR and BDR)
Insert picture description here
Insert picture description here
Type 3: Summary LSA (Summary Net Link State)
Link state ID: Address of destination network
Advertisement router: ABR
Advertisement scope: area between the announcement, an announcement from the region to another region,
advertisement content: the region of the class 1 and class 2 LSA aggregated transmitted to the other area (non backbone - "bone ). The subnet, mask, and ABR to destination cost in the source area are advertised, that is, the cost from a certain area to a router in another area is the cost from the local to the ABR, plus the cost advertised in the Type 3 LSA (LSA can only be updated and deleted by the sending router, other routers are only responsible for forwarding)
Generation and propagation rules of type LSA:
· ABR will only perform the SPF algorithm on the three types of LSAs from the backbone area to obtain the routing table, and then send the created LSA to the non-backbone area, but will not operate on the LSA from the non-backbone area (in an area There are two problems with ABR), but these LSAs will exist in the LSDB of the non-backbone area, and flood in the non-backbone area
· The flooding of the LSA, from the non-backbone area to the backbone area, will only consider intra-area routing
· LSA flooding, from the backbone area to the non-backbone area, will consider intra-area routing and inter-area routing

Insert picture description here
Insert picture description here
Type 4: ASBR summarizes LSA
link state ID: ASBR router ID
advertises the router: the original is the ABR of the area with external routes imported, and then the ABR of each area modifies the metric value and then enters the respective area
advertisement range: In addition to the entire OSFP domain in the stub area, the
content of the announcement: How to reach the
flooding ofASBRType 4 LSA: The original ABR injects the LSA into the backbone area (the metric value carried is the distance between ABR and ASBR) Then, modify the metric value (the original cost plus the distance from the ABR to the originally advertised ABR) and advertise it to the non-backbone area (the metric value from the ASBR in the non-backbone area router is the received Type 4 LSA plus the distance to the ABR)
Insert picture description here
Type 5: Autonomous system LSA
link state ID: External network number advertised into the autonomous system
Advertised router: RID of ASBR, ABR is only forwarded without modification
Announcement range: the entire OSPF autonomous system except the stub area

Insert picture description here
Type 7: NSSA external LSA
link status: Introduced external network number
Announcement range: only exists in the NSSA area and is flooded out as a type 5 LSA at the ABR. After converting to LSA type 5, an address (Forward Address) will be reserved, which is the ASBR interface address. The path from other areas to the outside is actually the path to the reserved addressInsert picture description here

4. About the characteristics and operation of LSA
(1) After the interface fails, the operation of LSA
sends a new type 1 LSA to tell neighbors that there is no link information
(2) The identity
of the router that generates LSA The router in the area generates: Type 1 and 2 Class LSA
ABR generation: Class 3 and Class 4 LSA
ASBR generates Class 5 and Class 7 LSA

7. OSPF area type and structure

1. Area type
(1) Backbone area: all areas must be connected to the backbone area
(2) Standard area: receive all internal and external routing information
(3) End area: do not accept routing information outside the autonomous system (4 types and Type 5 LSA)
(4) Complete stub area: only receive the internal routing information of the area Cisco dedicated, and connect to other areas through the default route (do not accept the type 3, 4, 5 LSA, communicate with the external network through the default route)
(5) NSSA: Receiving area routing and limited external routing information restricts information outside the autonomous system. There can be ASBR in the NSSA area.
(6) Complete NSSA: Receiving only routing information in the area and limited external routing information

2. The default route of OSPF stub area
(1) stub area, complete stub area, and complete NSSA area will automatically generate a default route between areas, NSSA area will not be automatically generated, you need to configure it manually

8. OSPF network type

1. Point-to-point connection
A network connecting a pair of routers, using the PPP HDLC protocol,
using multicast 224.0.0.5 to send various data packets

2. Broadcast
Multi-access networks, such as Ethernet, require DR and BDR elections.
Usually HELLO messages, LSU messages, and LSACK messages are sent in multicast, and DD and LSR messages
DR and BDR are sent in unicast. Non-designated routers send messages using multicast 224.0.0.5
Non-designated routers send messages to DR and BDR using multicast 224.0.0.6

3. Non-Broadcast Multiple Access (NBMA, Non-Broadcast Multiple Access)
connects more than two routers but does not have a broadcast function.
All data packets of the Frame Relay network and ATM network are sent unicast, and the neighbor is designated.

4. Point-to-multipoint
Hello packets are sent in multicast, other types of data packets are sent by unicast

9. OSFP path selection

1. OSPF route type
· O, intra-area route
· OIA, inter-area route
· OE2, external route, cost value does not change when propagating in the area
· OE1, external route, cost value changes when propagating in area
· ON2, Exist
in NSSA area , similar to OE2 · ON1, exist in NSSA area, similar to OE1
· O IA, inter-area default route
· O
N2, default route in NSSA area

2. Routing rules The
following are arranged in order of priority, with the highest priority appearing first
, intra
-area routing
, inter-area routing , E1 / N1 routing, these two types of routes are considered equal,
and E2 / N2 routing

Ten. Several advanced analysis questions of OSPF

The forwarding address problem in Class 1.5 LSA
(1) When OSPF imports an external route, if the forwarding address of the generated LSA is 0.0.0.0, other routers will consider how to reach the ASBR when calculating to reach the external network. The router of the type 5 LSA calculates the next hop address to the external route
(2) When the external route is imported by OSPF, if the forwarding address of the generated type 5 LSA is not 0.0.0.0, other routers calculate to reach the external In the network, we will consider how to reach the forwarding address to calculate the next-hop address of the external route.
When the following three conditions are met at the same time, the forwarding address of the type 5 LSA generated by OSPF is not 0.0.0.0.
· This imported external route, The corresponding outgoing interface is enabled with OSPF
· The imported external route, the corresponding interface is not set to passive-interface
· The imported external route, and the corresponding outgoing interface's OSPF type is broadcast. In
this case, the The type 5 LSA has a FA address equal to the next hop address of the imported external route
Insert picture description here
. The forwarding address
in the type 2.7 LSA. If an external route is imported in the NSSA area, the type 7 LSA generated The sending address is not 0, and the specific forwarding address is the IP address of the OSPF-enabled interface on the ASBR
(1) If OSPF is enabled on the loopback interface on the router, the forwarding address is equal to the OSPF-enabled loopback address. If there are multiple, then The forwarding address is equal to the IP address of the last loopback interface with OSPF enabled
(2) If there is no loopback interface on this router with OSPF enabled, then the FA address is equal to the physical interface address with OSPF enabled. If there are multiple, the forwarding address is the last OSPF enabled IP address of the physical interface

3. Route generation to the outside
(1) After receiving 5 types of LSA, check the forwarding address in the LSA. If it is 0.0.0.0, the generated route is essentially a route to ASBR. At this time, look for 4 types of LSA, according to 4 Use the metric in the LSA to calculate the route to the outside (consider OE1 and OE2, OE1 plus the internal cost of the autonomous system, OE2 does not add the internal cost of the autonomous system)
(2) If the forwarding address is not 0.0.0.0, go to The path to the outside is the path to the forwarding address

4. Virtual link problem In the
Insert picture description here
figure, the bottom two routers are in area 0, the two on the left are area 14, the two on the right are area 23, and the two on the top are area 12, ask at least a few virtual links to ensure normal running several virtual links to the most reliable
analysis:
a minimum of one to that routers 1 and 4 or 2 and 3 of
the original area 0,14,23 in the region, but the lack of region 12, and that between 1 and 4 The establishment of a virtual link can meet the most basic requirements, the
most reliable, 3

Published 24 original articles · praised 10 · visits 2379

Guess you like

Origin blog.csdn.net/flat0809/article/details/94601183