OSPF knowledge and related experiments

OSPF: Open Shortest Path First Protocol
Classless Link State Routing Protocol—Convergence based on topology. The biggest problem of this protocol is the amount of updates. Therefore, in order to be used in medium and large networks, the structure must be deployed—good address planning Area division triggers an update, a cycle every 30min; multicast update — 224.0.0.5 224.0.0.6
1. OSPF packet type
1, hello neighbor, discovery, establishment, and periodic keep-alive of adjacency relationships — carry router-id
2, DBD Database description table—directory
3. LSR link state request
4. LSU link state update—carrying various LSAs
5. LSack link state confirmation
2. OSPF state machine—the relationship between two OSPF routers.
DOWN Once sent locally Hello package, enter the next state.
Init. Initialize the received hello package. There is a local RID. Enter the next state.
2way. Two-way communication. Neighbor relationship establishment flag.
Condition matching:
Exstart pre-start uses DBD without directory information for master and slave relationship. For elections, the router-id value is the main one, and the next state is the priority.
Exchange quasi-exchange uses the DBD carrying directory information to share the database directory; ack is required to confirm
Loading After viewing the peer DBD, based on the local unknown LSA information, use LSR For query, the opposite end uses LSU to transmit LSA information, and ACK confirmation is required-to obtain unknown LSA information
Full forwards the sign of the establishment of adjacency relationship
3. After the OSPF working process is
started and the configuration is completed, the local send and receive hello packets, and establish a neighbor relationship with the opposite end ——Generate neighbor table'
After the neighbor relationship is established, the neighbors will match the conditions; if the match fails, it will stay in the neighbor relationship, and only the hello packet will be kept alive periodically;
between the devices that match the conditions, the neighbor relationship will be established; first use the DBD packet to obtain the adjacency LSDB directory;
then use LSR/LSU/LSack to obtain locally unknown LSA information;-generate a database table;
when the entire LSA is collected locally through all adjacency relationships, all LSA information is integrated-SFP algorithm calculation
-first generated Directional graph—shortest path tree—shortest priority route—routing table;
convergence complete; hello packet period keep alive; DBD comparison between adjacent periods every 30 minutes;
structural mutation:
1. Add network segment
2. Disconnect one segment
3, unable to communicate - lost contact hello time10s dead time off relations four times the hello, and delete information
LSA: link state Advertisements - specific topology or routing information
LSDB: link state database - a collection of all LSA
IV. Basic configuration of OSPF
[r1]ospf 1 router-id 1.1.1.1 It is necessary to define the process ID when starting, it is only of local significance and it is recommended to configure RID;
[r1-ospf-1]
Router-id—RID—The format is an IPV4 address, all Network unique ---- manual configuration, the largest numerical ip on the loopback interface, and the largest numerical ip address of the physical interface.
When announcing, it needs to be zoned
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0 .0.0]network 1.1.1.1 0.0.0.0
[R1-OSPF-0.0.0.0. 1-Area-] Network 12.1.1.0 0.0.0.255
[-R2-OSPF. 1] Area. 1
[. 1-R2-OSPF-Area-0.0.0.1] 0.0.0.0 23.1.1.1 Network
declaring The command must carry the anti-mask—exactly match the declared interface address.
Rules for dividing the area:
1. Star structure—area 0-bit backbone area, and greater than 0 is a non-backbone area. All non-backbone areas must be connected to the backbone area
2. ABR-area border router must exist.
After the configuration is completed, the neighbors send and receive hello packets to establish a neighbor relationship; generate a neighbor table:
[r2]display ospf peer View neighbor relationship information
[r2]display ospf peer brief View neighbor table summary
OSPF Process 1 with Router ID 2.2.2.2
Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 1.1.1.1 Full
0.0.0.1 GigabitEthernet0/0/1 3.3.3.3 After the Full
neighbor relationship is established, the neighbors will match the conditions; if the match fails, the neighbor relationship will stay in the neighbor relationship; Only hello packets are kept alive periodically; if the match succeeds, it will establish an adjacency; use DBD to send and receive database directories; use LSR/LSU/LSack to obtain unknown LSA information; finally realize database synchronization—generate database tables;
[r2]display ospf lsdb
When the database synchronization is completed, the local generated a directed graph based on the database, and then converted to the shortest path tree; then based on the tree structure to calculate the local shortest path to all unknown network segments, and then load it into the routing table;
[r1]display ip routing-table protocol ospf View the local routes learned through OSPF protocol
[r1]display ospf routing View the local ospf routes learned and transmitted through ospf.
OSPF in Huawei equipment, the default priority is 10; the metric is cost;
Cost Value=cost value=reference bandwidth/interface bandwidth The default reference bandwidth is 100M; if the reference bandwidth is less than the interface bandwidth, the cost value is 1;
the minimum sum of the cost values ​​of the entire path is the best path;
in OSPF, if the interface bandwidth If it is greater than the reference bandwidth, poor routing may occur; therefore, the reference bandwidth of the device can be modified;
if modified, all devices in the entire network need to be modified to be consistent;
[r1]ospf
[r1-ospf-1]bandwidth-reference?
INTEGER<1-2147483648> The reference bandwidth (Mbits/s)
[r1-ospf-1]bandwidth-reference 1000
V. OSPF extended configuration
1. Conditions for turning from neighbor relationship to adjacency relationship Pay
attention to network type:
point-to-point=in In a network segment, only two physical nodes can exist.
MA=Multiple access=In a network segment, the number of physical nodes is not limited
. In the point-to-point network type, the relationship between all neighbors is immediately established as an adjacency relationship;
OSPF in the MA network, if the number of adjacencies is not limited, a large number of repeated updates may occur;
therefore, DR (designated route)/BDR (backup designated route) election will be carried out; all non-DR/BDR relationships are neighbor relationships ;
Only establish an adjacency relationship with DR/BDR; –40S
election rules: first compare the priority of the participating interfaces; great advantage; the default is 1, 0-255;
if the interface priority is the same, compare the RID values ​​of the candidates, the value is higher Approximately excellent;
election is non-preempt, so you can interfere with the election after modifying the interface priority, but you must restart the ospf protocol of all devices;
[r1]interface GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ospf dr-priority 2 Modify the priority of the participating interface
reset ospf process Restart the ospf protocol
Warning: The OSPF process will be reset. Continue? [Y/N]:y
The default point-to-point interface priority is 0, and 0 means not to participate in the election;

2. Authentication—The data sent and received between neighbors has identity authentication
. Configure
[r1-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
number 1 is the secret key number, 123456 is the secret key; md5 is Mode; the
above 3 parameters must be exactly the same between neighbors

3. Area summary-interface summary is not supported, because the topology information transmitted in the same area cannot be summarized; area summary can only be performed when the ABR shares the router with other areas;
configure
[r2]ospf 1
[r2- on the ABR ospf-1]area 0 Enter the source area where the topology is located
[r2-ospf-1-area-0.0.0.0]abr-summary 1.1.0.0 255.255.252.0

4. Silent interface-only receives and does not send routing protocol information, and is used to connect to the user's PC interface; it must not be used to connect to the neighbor's interface
[r1]ospf 1
[r1-ospf-1] silent-interface GigabitEthernet 0/0/0

5. Default route—Configure on the border router, and then send a default message to the internal network, so that the internal device generates a default route to the border router
[r3]ospf 1
[r3-ospf-1]default-route-advertise always
6. OSPF experiment
Insert picture description here
1. IP address division
Insert picture description here
Insert picture description here
2. Configure IP address
Router port configuration IP[r1]interface GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ip ad 192.168.1.17 28
Create virtual loop
r1]int LoopBack 0
[r1-LoopBack0]ip ad 192.168.1.33 28
declare area
r1]ospf 1]
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.17 0.0.0.0
write
Export the default route [r4-ospf-1] default-route-advertise always
Modify the priority Change the priority of
r3 to 2, and change the priority of r1, r2 to 0
[r3]interface GigabitEthernet 0/0/0
[r3- GigabitEthernet0/0/1]ospf dr-priority 2
reset ospf process
Warning: The OSPF process will be reset. Continue? [Y/N]:y
can achieve the whole network reachability
Insert picture description here

Guess you like

Origin blog.csdn.net/m0_53067332/article/details/111464900