Single-area and multi-area of OSPF dynamic routing protocol

One, OSPF routing protocol

ospf: Link state routing protocol, its metric value is related to COST
cost=10^8/BW (network port bandwidth)

Interface Type cost
100M Fast Ethernet 1
10M Ethernet 10
56K 1785

The protocol number 89 is used in the IP data packet (network layer).

(1) Internal gateway protocol and external gateway protocol

1. AS autonomous system: a collection of routers managed by the same technical management organization and using a unified routing strategy.
2. Interior gateway protocol (IGP): interior gateway routing protocol, a routing protocol running inside the AS, mainly to solve the problem within the AS Route selection problems, discovery, and routing calculations. Mainly include RIPV1 and RIPV2, OSPF, ISIS
3. Exterior Gateway Protocol (EGP): The exterior gateway routing protocol, the routing protocol running between AS and AS solves the problem of routing between ASs. BGP

(Two) ospf working process

1. Neighbor list
2. Link state database
3. Routing table
The routing of the message-establishing adjacency relationship-(learning link state information)-link state database-(SPF algorithm)-shortest path tree-routing table

(Three) ospf area

1.1. In order to adapt to large-scale networks, OSPF divides multiple areas within the AS.
1.2. Each OSPF router only maintains the complete link state information of the area where it is located.
2. Area ID: The area ID can be expressed as a decimal number or as an IP
. 3. It is composed of a backbone area and a non-backbone area.
3.1 The backbone area Area 0 is responsible for inter-area routing information relay.
3.2 Non-backbone areas Area 1, Area 2

(4) Router ID

Router ID: The
router ID selection rule that uniquely represents the router's IP address in the OSPF area :
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
3. Use Router- The id command specifies the Router ID (the highest priority)

(5) DR and BDR

The adjacency relationship is established in the broadcast network and learns in pairs to form N(N-1)/2 links.
DR designated routers: all routers point to DR (designated routers) to learn, and form a one-to-one correspondence with other routes.
DRothers other routers: Only form adjacency with DR and BDR

(6) DR and BDR election methods

1. Automatically elect DR and BDR: the router with the largest router ID on the network segment: DR, the second largest: BDR
2. Manually select DR and BDR:

  • The priority range is 0~255, the larger the value, the higher the priority, the default is 1
  • If the priority is the same, you need to compare the Router ID
  • If the priority of the router is set to 0, it will not participate in the election of DR and BDR.
    The priority of the router can affect an election process, but it cannot be forced to replace the existing DR or BDR router. It is possible to open it first in a group of routers. Has become a DR

(7) Two multicast addresses

224.0.0.5—When powering on, send hello packets to each other, exchange status information, elect DR and BDR, DR, BDR send routing change messages to other routes
224.0.0.6—Other routers send route change messages to DR and BDR through 224.0.0.6 BDR

(8) Five types of ospf packages

Types of effect
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 Acknowledgement Packet (LSAck) Confirm that the DBD/ LSU has been received, each LSA needs to be confirmed separately

(9) 7 state machines for ospf to establish adjacency relations

1. Down (initialization): The initial state of the neighbor state machine, when the Hello message from the other party is not received or OSPF is not started.
2.Init (received the first hello packet): the neighbor received the hello packet containing my Router ID sent by me, but I did not receive the hello packet from the neighbor
3.2-Way (establish a two-way session): this state means both parties After receiving Hello messages from the opposite ends, a neighbor relationship is established. I also received a hello packet containing the router ID of the neighbor.
4. ExStart (to establish a master-slave relationship): In this state, DR and BDR are elected to establish a master-slave relationship by comparing Router ID and priority.
5. Exchange (exchange summary information): send a summary of the link state information of DBD messages to each other, and send a LAck message to each other to confirm receipt of the DBD message
6. Loading (loading detailed information): get new information from the DBD message Route summary message, LSR message is sent to request more detailed routing information, neighbors send LSU message containing complete information about the new routing entry, and each other sends LAck to confirm receipt of LSA link state notification, LSU contains multiple LSA entries, Each LSA must be confirmed.
7. Full (connection completed): In this state, all LSAs in the LSDB of the neighboring router are present in the local router. Completed the establishment of adjacency relations.

(10) OSPF network type

1. Point-to-point network (pint-to-point)-automatically
discover neighbors, without DR/BDR, multicast 224.0.0.5
2. Broadcast MultiAccess (Broadcast MultiAccess, BMA)-automatically
discover neighbors, select DR/BDR, multicast 224.0.0.5, 224.0.0.6
3. Non-broadcast multi-access network (None Broadcast MultiAccess,, NBMA)-manually
specify neighbors, select DR/BDR, unicast
4. Point-to-multipoint network ( Point-to-Multipoint) ——Automatically
discover neighbors without DR/BDR. Multicast 224.0.0.5
(11) OSPF features
1. Adaptable to large-scale networks
2. Fast convergence of router changes
3. No routing loops
4 .Support regional division
5. Support variable-length subnet mask
6. Support sending protocol with multicast address

2. Principle and configuration of OSPF multi-area

(I. Overview

1. Reasons for multiple zones

Reasons for generating OSPF multi-domain: a. Improve network scalability b. Accelerate convergence

2. ospf three kinds of communication

2.1
Intra -area traffic (intra-area traffic) The traffic constituted by the exchange of data packets between routers in a single area
2.2 Inter-area traffic (inter-area traffic) The traffic
constituted by the exchange of data packets between routers in different areas
2.3 External traffic (external traffic) The traffic constituted by the exchange of data packets between a router in the OSPF area and a router outside the OSPF area or in another autonomous system

3. OSPF router type

3.1 Internal router: only saves the link state information of this area.
3.2 Area Border Router (ABR): will be responsible for the communication between Area 0 and other areas.
3.3 Autonomous System Border Router (ASBR): Learn external routes and inject them into the ospf area. Learn ospf area routing and inject it into other ASs

4. Area type

4.1 Backbone area
4.2 Non-backbone area (differentiated according to the types of routes that can be learned)
a. Standard area
b. Stub area (stub)
c. Totally stubby area
d. Non-pure stubby area (nssa)

(2) Link state database

1. The composition of the link state database

1.1 Each router creates a database composed of each interface, corresponding neighboring nodes, and interface speed.
1.2 Each entry in the link state database is called LSA (Link State Advertisement). There are six common types of LSA

2. Common 6 types of LSA

Type 1 (router LSA): sent by routers in the area, describing the link status and cost of the router, and passed to the entire area
Type 2 (network LSA): sent by the DR in the area, describing changes in the area , Spread
Type 3 (Network Summary LSA) in the entire area : ABR issued, summary link announcements in other areas, describing the route of a certain network segment in other areas, and
Type 4 (ASBR Summary LSA) transmitted between areas : ABR Sent, 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): Sent from the ASBR, used to advertise external routes, telling the routers of the same AS to go to the external AS path, flooding throughout the AS
Tpye 7 (NSSA external LSA): ASBR in the NSSA issued for external routes advertised in the region of the connection, similar to the Type 5, only ubiquitous non stubby area Hong, it will be converted to LSA5 by ABR during transmission

(3) Peripheral area and complete peripheral area

1 Overview

1. Four conditions

  • There is only one default route as the exit of its area
  • The area cannot be used as the traversal area of ​​the virtual link
  • There is no autonomous system border router ASBR in the stub area
  • Not a backbone area Area 0

2. Stub area: no LSA4, 5, 7 advertisements.
Completely stub area: Except for a default route advertisement of LSA3, no LSA3, 4, 5, 7 advertisements
. 3. Function: Its main purpose is to reduce LSA entries and routes in the area Entries to reduce the CPU and memory usage of the device; ABR in the peripheral area and the complete peripheral area will automatically generate a default route and advertise to the peripheral area or the complete peripheral area.

2. Peripheral area configuration commands

ABR configuration
[R4]ospf 1
[R4-ospf-1]area 0 #First configure the network segment directly connected to other areas
[R4-ospf-a-area-0.0.0.0]network xxxx xxxx #Declare the directly connected network segment , Reverse mask
[R4-ospf-1]area 2
[R4-ospf-a-area-0.0.0.2]network xxxx xxxx #Declare directly connected network segments, reverse mask
[R4-ospf-a-area-0.0. 0.2] stub
area internal routing configuration
[R5]ospf 1
[R5-ospf-1]area 2
[R5-ospf-a-area-0.0.0.2]network xxxx xxxx #Declare directly connected network segment, reverse mask
[R5- ospf-a-area-0.0.0.2]stub

3. 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 # Declare the directly connected network segment first, reverse the mask
[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 #Declare the direct network first Segment, reverse mask
[R5-ospf-a-area-0.0.0.2]stub

(4) ospf multi-zone configuration experiment

Insert picture description here

r1

u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1
[r1]user-interface console 0
[r1-ui-console0]idle-timeout 0 0
[r1-ui-console0]int g0/0/0
[r1-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[r1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[r1-GigabitEthernet0/0/0]int loopback 0
[r1-LoopBack0]ip add 1.1.1.1 32
[r1-LoopBack0]q
[r1]ospf 1
[r1-ospf-1]area 2
[r1-ospf-1-area-0.0.0.2]netw
[r1-ospf-1-area-0.0.0.2]network 12.0.0.0 0.0.0.255
[r1-ospf-1-area-0.0.0.2]
[r1-ospf-1-area-0.0.0.2]network 1.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.2]
[r1-ospf-1-area-0.0.0.2]
[r1-ospf-1-area-0.0.0.2]q
[r1-ospf-1]dis ip rout
[r1-ospf-1]dis ip routing-table
[r1-ospf-1]area 2
[r1-ospf-1-area-0.0.0.2]stub

r2

u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r2
[r2]user-interface console 0
[r2-ui-console0]idle-timeout 0 0
[r2-ui-console0]q
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[r2-GigabitEthernet0/0/0]
[r2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]undo shutdown
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[r2-GigabitEthernet0/0/1]ip add 23.0.0.1 24
[r2-GigabitEthernet0/0/1]int loopback0
[r2-LoopBack0]ip add 2.2.2.2 32
[r2-LoopBack0]q
[r2]ospf
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[r2-ospf-1-area-0.0.0.1]area 2
[r2-ospf-1-area-0.0.0.2]network 12.0.0.0 0.0.0.255
[r2-ospf-1-area-0.0.0.2]network 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.2]stub

r3

[Huawei]sysname r3
[r3]user-interface console 0
[r3-ui-console0]idle-t
[r3-ui-console0]idle-timeout 0 0
[r3-ui-console0]q
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[r3-GigabitEthernet0/0/0]ip add 23.0.0.2 24
[r3-GigabitEthernet0/0/0]int g0/0/01
[r3-GigabitEthernet0/0/1]ip add 34.0.0.1 24
[r3-GigabitEthernet0/0/1]undo shutdown
Info: Interface GigabitEthernet0/0/1 is not shutdown
[r3-GigabitEthernet0/0/1]int loopback 0
[r3-LoopBack0]ip add 3.3.3.3 32
[r3-LoopBack0]q
[r3]ospf
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0

r4

[Huawei]undo info-center enable
Info: Current terminal monitor is off.
sy
Enter system view, return user view with Ctrl+Z.
[Huawei]user-interface console 0
[Huawei-ui-console0]idle-timeout 0 0
[Huawei-ui-console0]q
[Huawei]int loop0
[Huawei-LoopBack0]ip add 4.4.4.4 32
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 34.0.0.4 24
[Huawei-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 45.0.0.4 24
[Huawei-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[Huawei-GigabitEthernet0/0/1]q
[Huawei]ospf
[Huawei-ospf-1]area 0
[Huawei-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-]ospf
[Huawei-ospf-1]area 1
[Huawei-ospf-1-area-0.0.0.1]un network 45.0.0.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.1]q

r5

[Huawei]sysname r5
[r5]user-in
[r5]user-interface con
[r5]user-interface console 0
[r5-ui-console0]idle-t
[r5-ui-console0]idle-timeout 0 0
[r5-ui-console0]q
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 45.0.0.2 24
[r5-GigabitEthernet0/0/0]undo shu
[r5-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 56.0.0.1 24
[r5-GigabitEthernet0/0/1]undo shu
[r5-GigabitEthernet0/0/1]undo shutdown
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[r5-GigabitEthernet0/0/1]int loop0
[r5-LoopBack0]ip add 5.5.5.5 32
[r5-LoopBack0]q
[r5]ospf 1
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]netw
[r5-ospf-1-area-0.0.0.1]network 45.0.0.0 0.0.0.255
[r5-ospf-1-area-0.0.0.1]network 56.0.0.0 0.0.0.255
[r5-ospf-1-area-0.0.0.1]network 5.5.5.5 0.0.0.0

r6

u t m
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r6
[r6]user-interface console 0
[r6-ui-console0]idle-timeout 0 0
[r6-ui-console0]q
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 56.0.0.2 24
[r6-GigabitEthernet0/0/0]int loop0
[r6-LoopBack0]ip add 6.6.6.6 32
[r6-LoopBack0]int g0/0/0
[r6-GigabitEthernet0/0/0]undo shu
[r6-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[r6-GigabitEthernet0/0/0]q
[r6]ospf
[r6-ospf-1]area 1
[r6-ospf-1-area-0.0.0.1]netw
[r6-ospf-1-area-0.0.0.1]network 56.0.0.0 0.0.0.255
[r6-ospf-1-area-0.0.0.1]netw
[r6-ospf-1-area-0.0.0.1]network 6.6.6.6 0.0.0.0
[r6-ospf-1-area-0.0.0.1]q
[r6]ping -a 6.6.6.6 1.1.1.1

Guess you like

Origin blog.csdn.net/weixin_53567573/article/details/112665444