Dynamic routing (two) ---OSPF protocol learning

Dynamic routing (two)-OSPF protocol learning

1. OSPF related

1.1 Interior Gateway Protocol and Exterior Gateway Protocol

Autonomous system (AS)
refers to a collection of routers with the same technical management structure using a unified routing strategy, which generally refers to the same area.
Internal Gateway Protocol (IGP)
includes RIP, OSPF and other
external gateway protocols (EGP),
BGP and other
internal gateway protocols inside each AS, and external gateway protocols outside each AS, responsible for the connection protocol between ASs.
Insert picture description here

1.2 Link State Routing Protocol

routers have a complete understanding of the whole network topology. It is the "route of the letter". A puts the information in a letter and sends it to B. B does not make any changes to it, copies it, and puts his new play in another letter, and sends the two letters together C. In this way, there is no change or loss of information. In the end, all routers receive the same bunch of letters, and this bunch of letters is LSDB. Then, each router runs the same SPF algorithm, takes itself as the root, calculates the SPF Tree (that is, each plan to reach the destination), selects the best path, and puts it into the routing table.

1.3 OSPF working process

The OSPF link state routing protocol has three key tables:
neighbor list,
link state database,
routing table
1. Establish adjacency relationships through the signaling process of each route.
2 Then learn all the link state information, at this time all the routes have a clear understanding of the entire network structure.
3 Put all the information into the link state database.
4 Calculate the shortest path tree through SPF algorithm.
5 Finally, the routing table is generated.
Insert picture description here

1.4 OSPF area

In order to adapt to a large-scale network, OSPF divides multiple areas within the AS.
Each OSPF router only maintains the complete link state information of the area where it is located, and non-backbone areas directly do not know each other.
The following Area 0 is the backbone area (the backbone area in the figure), and 1 and 2 are the non-backbone areas. The non-backbone areas surround the backbone area
. All communications between non-backbone areas need to pass through the backbone area, and the backbone area is necessary.

Insert picture description here

1.5 Area ID

It can be expressed as a decimal number or as an IP address.
Backbone area Area 0: responsible for the propagation of routing information between areas.
Router ID: the IP address that uniquely identifies the router in the OSPF area

1.6 Router ID selection rules

: (The highest manual priority)
1. Select the IP address with the highest value on the router loopback interface
2. If there is no loopback interface, select the physical port with the highest IP address
You can also use the router-id command to specify the router ID

2. DR and BDR

In a broadcast network, when there are multiple routing devices, the adjacent relationship between each other is very complicated. As shown in the figure below, if there are more routers in a network, mutual adjacency will cause a lot of congestion.
There can be n(n-1)/2 adjacency relations. It is conceivable that when there are more routers, the adjacency relations will be complicated.

Insert picture description here
So at this time, in order to alleviate this situation, we have DR and BDR.
DR: In a group of networks, the router that is elected or the first to operate (first-in-class) is the DR router, which is used to connect to all other routers and is responsible for communication between other routes, all passing through the DR router (captain router).
BDR: By electing the second priority router, it is responsible for the backup route of the DR. When the DR router fails, it will automatically take the position of the DR team leader.
DRothers: All routers except DR and BDR are connected to DR and BDR. Others cannot be directly connected to each other. All routers need to pass DR or BDR.
The role of DR is that in the same group of networks, all other routers only form routing adjacencies with DR and BDR. Just connect with them.
As shown in the figure below, the original complicated connection method is directly simplified as all other routers are connected to DR or BDR. If all other routers communicate first, they need to communicate with the DR, and then the DR will transfer to other routers after receiving it. When the DR is broken down by a fault, BDR automatically replaces the DR function.
Insert picture description here
After introducing the relationship between DR and BDR, let's talk about how to elect.

2.1 Election method:

ps: Only when the original DR and BDR are down, will the election be re-elected. Even if the priority is high, the existing DR and BDR cannot be replaced forcibly, and elections will not be made until the main and standby are all hung up.
Automatic: The
router ID (expressed in IP) on the network segment is the largest router election as DR, and the second largest election is BDR
Manual: the
priority range is 0~255, the greater the value, the higher the priority, the default is 1
if priority
If the same, compare RouterID. If the priority of the router is set to 0, then it does not participate in the election of DR and BDR.

2.2 OSPF multicast address

There are two: and When the
DR and BDR are not selected at the beginning, all routes send HELLO packets in the address for active and standby elections.
When the main and backup elections are successful, is only used by the main and standby routers, and all other routers communicate at the address of
All routers send hello packet election in After DR and BDR are determined, other routers send to communicate with DR and BDR. After DR and BDR are received, they are sent to other routers through
Therefore, when the election is over:
DR and BDR (active and standby routers) always monitor the multicast address
DRothers (other routers) always monitor the multicast address

2.3 The OSPF metric value is COST

COST=10^8/BW The
shortest path is calculated based on the cost specified by the interface (cost)

Interface Type Cost (108/BW)
Fast Ethernet 1
Ethernet 10
56K 1785

As shown in the figure, the greater the interface bandwidth, the lower the cost.

2.4 OSPF packets

Carried in IP data packets (network layer), using protocol number 89.
OSPF packet types (five types of packets)

OSPF packet type description
Hello bag Used to discover and maintain neighbor relationships, elect DR and BDR
Database Description Package (DBD) Used to send summary information to neighbors to synchronize the link state database
Link State Request Packet (LSR) After the router receives the DBD containing the new information, it is sent to request more detailed information
Link State Update Package (LSU) Send link state advertisement (LSA) after receiving LSR, one LSU packet may contain several LSAs
Link status confirmation packet (LSAck) Confirm that the DBD/LSU has been received, and each LSA needs to be confirmed separately

2.5 OSPF seven states

Link: Here is the interpretation of other people's CSDN on the state. [Detailed explanation of seven states]
(https://blog.csdn.net/qq_37716168/article/details/86362509?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-4.channel_param&depth_1-utm_source=distribute.pc_relevant.none -task-blog-BlogCommendFromMachineLearnPai2-4.channel_param).

Seven state processes:
OSPF uses the SPF algorithm to calculate routes to ensure that no routing loops will occur from the algorithm. Based on link status. The default management distance is 110, the IP datagram is used for closure, the protocol number is 89, and the multicast address is (DR/BDR is not selected) and (DR/BDR is selected).

The dynamic routing protocol has its own backup function. The router forwards data through the routing table.

The OSPF protocol does not transmit routing entries, but transmits link state information and calculates routes based on this information.
In a network, routers use the same protocol: a router receives the destination from two directions, depending on Bandwidth determination (cost value)
In a network, routers use different protocols: a router receives the same destination from two directions, and compares the administrative distance (priority)

Take a look at the seven states of OSPF.
Insert picture description here

Look at the picture above: the two routers have enabled OSPF interfaces, but they have not received any information from their neighbors. This is the Down state and the initial state of the neighbors.
Insert picture description here

The routers exchange hellos to establish and maintain neighbor relationships. (Detecting that the other party is still alive)

Insert picture description here

A sent a hello packet, and B also received a hello packet from A, but B found that this packet did not have its own router-id. Although it received the hello packet, it did not have its own name. This is the init state.
Insert picture description here

Now B also sends a hello packet to A, and A receives the hello packet from the neighbor and finds its router-id in the packet, which enters the 2-way state, two-way communication state, forming a neighbor relationship.

At this stage, DR/BDR will be elected. DR is like the eldest brother in the cottage. Then BDR is the second elder brother, and the eldest brother will be replaced by the second elder brother. How about the election? Look at the priority, the bigger the better, the same priority, the bigger the router-id, the better.

The role of DR election: in order to reduce the adjacency in multiple access
Insert picture description here

After the DR/BDR election is completed, it now enters EXstart. In this state, each router will send a DBD message. According to the router id in the DBD message, the larger the better, the master is elected at this time, and the master-slave relationship is confirmed. This master can be preempted. If the router (router-id) added later is better, it will preempt to become the administrator.

Role of DBD
1. Establish adjacency relationship
2. DBD without LSA header, used to elect master and slave
3. DBD with header, used to exchange link state summary messages
Insert picture description here

The master will arrange the sending order of DBD messages. As you can see, of these two routers, router B has a larger router id, so router b first sends a DBD message, which carries its own link state database, and router A also sends a DBD message to B. Thereby the link status is exchanged.
Insert picture description here

At this time, router A finds that a certain piece of information is missing in the link state database according to the message of router B, and then A will send a request message LSR so that B will send the corresponding information to itself. After receiving the LSR request from A, B sends the information it needs to A through the LSU update message, and sends an LSACK confirmation message. Said it has been received.

Full: The adjacency state
A will be stored in the LSDB after it is received, and the LSDB will be fully synchronized after learning.

Insert picture description here
Down: OSPF is not enabled; it changes to this state when the neighbor fails

Init: Initialization state, when receiving the hello packet (including the route-id of the peer) from the peer for the first time, set the state of the peer to init

2-way: neighbor status, the status of periodically sending hellos to each other (the two parties establish a session)

Exstart: Initialization state of exchange information

Send DBD (containing the local LSA summary information) message to elect the master-slave router (using the ID and priority in the HELLO message to conduct elections, no preemption is allowed, the DR is gone, and the DBDR can be uploaded)

Exchange: Status of information exchange

In this state, DBD is sent to each other to inform the opposite end of the local LSA directory; at the same time, LSR, LSU, LSACK can be sent to learn the opposite end’s LSA

Loading: Loading state (the state that has not been studied)

Send LSR, LSU, LSACK, specifically to learn the detailed information of the opposite end's LSA

Full: adjacency state (state after learning)

LSDB synchronization with each other, that is, all LSAs are the same
Insert picture description here

2.6 OSPF divides the network into four types

  1. Point-to-point network
    Automatically discover neighbors without DR/BDR, multicast
  2. Broadcast multiple access network
    automatically discover neighbors, select DR/BDR, multicast
  3. Non-broadcast multi-path access to the network
    Manually specify neighbors, select DR/BDR unicast
  4. Point-to-multipoint network
    Automatically discover neighbors, without DR/BDR, multicast

2.7 Features of OSPF

Insert picture description here

2.8 Comparison of OSPF and RIP

Insert picture description here

3. OSPF simulation experiment

1. First configure the interface IP addresses of all routers in the topology diagram, and the loopback addresses on each route (loopback)

Insert picture description here
2. Configure OSPF protocol on each router

Insert picture description here
Other routers are also configured in the same way.

Guess you like

Origin blog.csdn.net/weixin_44324367/article/details/109487801