Common dynamic routing OSPF

1 Overview of OSPF routing protocol

1. Autonomous System (AS)

AS refers to a collection of routers that are managed by the same technical management organization and use a unified routing strategy.

2. Classification

Insert picture description here

1. Classified by agreement type:

The distance vector routing protocol
router has an insecure understanding of the entire network topology. It is a "legendary route". For example, A sends routing information to B, and B adds its own metric and sends it to C. The information in the routing table is all "listen". "Come on.
Mainly include: RIP, IGRP, EIGRP, etc.
Link state routing protocol
routers have a complete understanding of the topology, and are "routes for sending messages". For example, A puts the message in the letter and sends it to B, and B does not make any changes and copies it. Put your own information in another letter, and send the two letters to C together. In this way, if information 5 is changed or lost, all routes will receive the same bunch of letters. This bunch of letters is LSDB (chain Road status database). Then each router uses 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.
Mainly include: OSPF, IS-IS, etc.
2. Classified by self-made system:

Intranet IGP (Interior Gateway Routing Protocol): The
internal gateway routing protocol is a routing protocol that runs inside the AS. It mainly solves the problem of selection within the AS, discovers and calculates routes.
Including: RIP, OSPF, IS-IS, etc.

Internet EGP (External Gateway Routing Protocol): The
external gateway reason protocol is a routing protocol running between AS and AS, which solves the problem of routing between ASs.
Contains: BGP.

OSPF

Link state routing protocol: OSPF
routers have a complete understanding of the entire network topology. It is the route of sending a 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 information in another letter. The two letters are sent to c together, so, 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 the SLDB. Then, each router uses 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.

##OSPF working process
1. Neighbor list
2. Link state database
3. Routing table
Insert a picture here to describe the
Insert picture description here
OSPF interface to send Hello packets, establish neighbor relationships , and then learn link state information (send LSA link state notifications to each other Announce routing) to form a link state database . Through the Dijkstra algorithm (SPF algorithm), calculate the most short-path tree after (cost minimum) into the routing table .

2 OSPF area

●In order 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 where it is located.

Area ID
1) The area ID can be expressed as a decimal number or an IP.
2) In terms of area division, generally Area 0 is the backbone area, and the others are non-backbone areas. Non-backbone areas cannot communicate directly, and all communications must pass through the backbone area.

Router ID

Router ID: the IP address that uniquely identifies the router in the OSPF area

Router ID selection rules
●Select the IP address with the highest value on the loopback interface of the router.

●If there is no loopback interface, select the one with the highest IP address among the physical ports.

●You can also use the router-id command to specify the router id, which has the highest priority.

OSPF metric: COST

Rule: The smaller the value, the higher the priority. The
shortest path is calculated based on the cost (COST) specified by the interface.
Calculation formula = 108/BW
commonly used ports and COST

Interface Type COST(108/BW)
Gigabit Ethernet 0.1
fast Ethernet 1
Ethernet 10
Telephone line 56K 1785

DR.BDR and DRother

DR and BDR
When multiple OSPF routers are connected to the same multi-access network segment, if every two routers exchange LSAs with each other, then the network segment will be full of many LSA entries, in order to minimize the number of LSA propagation At this time, a router needs to exchange LSAs with all routers to reduce the number of LSAs, then this router is called DR; when DR is selected, one is also selected as a backup, called BDR; finally other routers (DRothers ) Only form an adjacency relationship with DR and BDR.

DR and BDR election methods
Automatically elect the
router with the largest router ID on the DR and BDR network segments will be elected as the DR, and the second largest will be elected as the BDR.
Manually select the DR and BDR
priority ranges from 0 to 255, the larger the value , The higher the priority, the default is 1.
If the priority is the same, you need to compare Router lD.
If the priority of the router is set to 0, it will not participate in the election of DR and DBR. In
reality, few routers can be powered on at the same time, so DR goes online first, and BDR goes online second.
Note: When DR and BDR exist, they cannot be replaced unless they are down.
DRother: other routing

The router priority can affect an election process, but it cannot force an existing DR or BDR to be replaced

OSPF multicast address
224.0.0.5-just start, send hello packets to each other, exchange status information, elect DR and BDR
224.0.0.6-other routers send their own information to DR and BDR through 224.0.0.6

DR and BDR then forward the received information to other routers through 224.0.0.5, which
can be understood as: DR.BDR monitors 224.0.0.6
DRothers monitors 224.0.0.5

OSPF data packets (a protocol) are
carried in IP data packets, using protocol number 89

OSPF packet types (five packets)

1. hello package———————— used to discover and maintain neighbor relationship, elect DR and BDR
2. Database description package (DBD)———— used to send summary information to neighbors to synchronize link status Database
3. Link State Request Packet (LSR)————Sent after the router receives the new DBD, requesting more detailed information
4. Link State Update Packet (LSU)————Sent after receiving the LSR Link State Announcement (LSA), the collective LSU of LSA
5. Link State Acknowledgement Packet (LSACK) ---Confirm that DBD/LSU has been received, and each LSA needs to be confirmed separately

OSPF adjacency relationship establishment (seven states)

1. Down state-initial state
2. Init state-receiving the first hello packet
3.2-way state-two-way session establishment
4. ExStart state-establishing a master-slave relationship
5. Exchange state-exchange Summary information
6. Loading state-loading detailed information
7. Full state-fully connected

OSPF network type (four types)

Point-to-point network
-automatically discover neighbors, without DR/BDR, multicast 224.0.0.255

Broadcast multiple access network
-automatically discover neighbors, select DR/BDR, multicast 224.0.0.5, 224.0.0.6

Non-broadcast multiple access network
-manually specify neighbors, select DR/BDR, unicast

Point-to-multipoint network
-automatically discover neighbors without DR/BDR and multicast 224.0.0.5

Comparison of OSPF and RIP

OSPF RIP V1 RIP V2
Link state routing protocol Distance vector routing protocol Same as V1
No hop limit RIP’s 15-hop limit, routes exceeding 15 hops are considered unreachable Same as V1
Support variable length subnet mask (VLSM) Does not support variable length subnet mask (VLSM) Support variable length subnet mask (VLSM)
Fast convergence Slow convergence Same as V1
Use multicast to send link state updates Periodically broadcast to update the entire routing table Periodic multicast update the entire routing table

Configuration command

[R1]ospf 1 router-id 1.1.1.1
create an ospf process, configure Router ID
[R1-ospf-1]area 0 to
create area 0, area 0 is the backbone area
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
Announce direct route, use reverse mask
[R1-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.255

View the command
display ospf 1 peer brief ---------View the brief information of the OSPF neighbor table
display ospf 1 peer ---------------View the detailed information of the OSPF neighbor table
display ospf 1 brief -----------------View the relevant information of OSPF 1 on the local device
display ip routing-table -----------View the routing table OSPF routing (determine the type and attributes of the router)
display ospf routing
display ospf interface GigabitEthernet 0/0/0

3 OSPF multi-area

1. In large enterprise networks, the following problems are often encountered when using OSPF routing protocol

In large-scale enterprise networks, changes in the network structure occur frequently, so OSPF routers often run SPF algorithms to recalculate routing information, which consumes a large amount of CPU and memory resources of the router.
In an OSPF network, with the increase of multiple paths, the routing table becomes larger and larger. Each time the path changes, the router has to spend a lot of time and resources to recalculate the routing table, and the router becomes more and more. Inefficient.
The link state database containing complete network structure information will also become larger and larger, which may completely exhaust the router's CPU and memory resources, which will lead to the collapse of the router.
To solve this problem, OSPF allows a large area to be divided into multiple smaller areas that are easier to manage. These small areas can exchange route summary information, rather than the details of each route. By dividing into multiple small areas, OSPF can work more smoothly.

1. Reasons for OSPF multi-area generation

1) Improve the scalability of the network
2) Fast convergence

2, OSPF-like traffic

1) Intra-domain traffic: it is the traffic of data packets exchanged by routers in the same OSPF area
2) Inter-domain traffic: is the traffic when a router in an OSPF area exchanges data packets with a router in another OSPF area
3) External Traffic: The traffic of data packets exchanged between routers in the OSPF area and routers outside the OSPF area or in another autonomous area

3. Types of routers in OSPF

1) Internal router: The router only saves the link state information of this area.
2) Area border router (ABR): The router connecting the area and other areas; the link state information of the connecting area is aggregated and sent to area 0, and other areas The link state information of the area is sent to the connected area
3) Autonomous System Boundary Router (ASBR): used to connect the OSPF area and external routers; and inject external routes into the OSPF network

4. OSPF area type

1) Backbone area: area 0, the core of the OSPF area, and other areas must be connected to this area.
2) Non-backbone area-according to the types of routes that can be learned,
non-backbone areas are divided into standard areas, stub areas, and complete Totally stubby area, non-purely stubby area (NSSA).
Next we introduce the peripheral area and the complete peripheral area.
Those that meet the following conditions can be identified as peripheral areas and complete peripheral areas

There is only one default route as the egress of its area. The
area cannot be used as a virtual link to traverse the area
. There is no autonomous system border router in the stub area. The ASBR
cannot make the backbone area Area 0. The
peripheral area reduces the number of LSAs and reduces the waste of router resources. With LSA4, LSA5, and LSA7 announcements, the ABR will send a default route to the stub area.
The completely stub area only accepts a default route provided by LSA3, and there is no LSA3, LSA4, LSA5, or LSA7 advertisement.
This greatly reduces the routing entries in the routers. Therefore, the performance of these routers will be greatly improved, and the memory will also be saved.

5 Composition of the link state database

Each router creates a database consisting of each interface, corresponding neighboring nodes, and interface speed

Each entry in the link state database is called LSA (link state advertisement), and there are six common types of LSA

LSA type description use
Type 1 Router LSA Sent by routers in the area, describing the link status and cost of the router, and transmitted to the entire area
Type 2 Network LSA Issued by the DR in the area, describing the change information in the area, and passing it to the entire area
Type 3 Network summary LSA The summary link announcement issued by ABR in other areas describes the route of a certain network segment in other areas and is transmitted between areas
Type 4 ASBR summary LSA Issued by ABR, used to advertise ASBR information, determine the location of the ASBR, and will not appear in the area where the ASBR belongs
Type 5 AS external LSA Issued by ASBR, used to advertise external routes, tell the routers of the same AS the path to the external AS, and flood the entire AS
Type 7 NSSA external LSA The ASBR in the NSSA area is used to advertise the external routes connected to the area. Similar to Type 5, it is only flooded in the non-pure stub area, and will be converted to LSA5 by ABR during delivery.

6 Peripheral area and complete peripheral area

An area that meets the following conditions:
● There is only one default route as the egress of its area
● The area cannot be used as a virtual link traversal area
● There is no autonomous system border router ASBR in the stub area
● The backbone area Area 0 cannot have LSA 4, 5, 7 in the
peripheral area
notice

Completely stub area
Except for a default route advertisement of LSA3, there is no advertisement of LSA3, 4, 5, and 7

This greatly reduces the routing entries in the routers. Therefore, the performance of these routers will be greatly improved, and the memory will also be saved.

Its main purpose is to reduce the LSA entries and routing entries in the area, and reduce the CPU and memory usage of the device; the ABR in the stub area and the complete stub area will automatically generate a default route and advertise it to the stub area or the complete stub area.

7 Peripheral area configuration commands

ABR configuration
[R4] ospf 1
[R4-ospf-1] area 2
[R4-ospf-a-area-0.0.0.2] network xxxx xxxx
first declare the directly connected network segment, and then configure
[R4-ospf-a-area- 0.0.0.2] stub

Intra-area routing configuration
[R5] ospf 1
[R5-ospf-1] area 2
[R5-ospf-a-area-0.0.0.2] network xxxx xxxx
first declare the directly connected network segment, and then configure
[R5-ospf-a- area-0.0.0.2] stub

8 Completely peripheral area configuration commands

ABR configuration
[R4] ospf 1
[R4-ospf-1] area 2
[R4-ospf-a-area-0.0.0.2] network xxxx xxxx
first declare the directly connected network segment, and then configure
[R4-ospf-a-area- 0.0.0.2] stub no-summary

Intra-area routing configuration
[R5] ospf 1
[R5-ospf-1] area 2
[R5-ospf-a-area-0.0.0.2] network xxxx xxxx First declare the directly connected network segment, and then configure
[R5-ospf-a- area-0.0.0.2] stub no-summary

Guess you like

Origin blog.csdn.net/zhangyuebk/article/details/112505825