How is OSPF established successfully?

Source: Internet
Author: User


How does OSPF establish the neighbor relationship? First, send a hello packet to all neighbors, create a neighbor, and put it in your neighbor table. Then, send the LSA to the neighbor, receive the neighbor of the LSA, put the LSA into its own database, run the SPF algorithm, and generate a shortest path tree rooted in itself, the number of shortest paths has two characteristics: one is the shortest path and the other is the absence of loops. Finally, the optimal path from the computer is placed in the route table. OSPF five types of packets: 1) Hello: It is found that the connection is established to maintain the adjacent relationship. Select DR-BDR. 2) DBD: contains the route summary information. Select the master-slave relationship to describe the header of the LSA packet. 3) LSR: Link Status request. Used to request the real LSA. 4) LSU: contains the real LSA. 5) LSAck: used to confirm the LSU you received. Because the IP address is unreliable. The ospf package is directly encapsulated in the IP package. If the Protocol Number is 89 and the 98 is used, we can match the OSPF package. Example: www.2cto.com r2 (config) # access-list 101 per 89 any r2 # sh access-lists 101 Extended IP access list 101 10 permit ospf any all OSPF Baotou version number 2 type 1 stands for hellotype 2 stands for DBDtype 3 LSACKpacket lengthRoute ID represents LSUtype 5 represents LSACKpacket lengthRoute ID identifies which router area ID identifies the check-sumauthen-tication type authen-tication data in which region when your TYPE is 1 in the hello packet, what are the fields Router idHell and dead intervals * NeighborsArea id * Rou? Ter priorityDR ip addressBDR ip addressAuthentication password * Stub area flag ** is a required condition for building a neighbor. To change hello and dead, use the following methods: www.2cto.com r1 (config) # int s1/0r1 (config-if) # ip ospf hello-interval 11 change the HELLO time of R1 r1 R1 (config-if) # ip ospf dead-interval 40 change the dead time of R1 to the HELLO time, the dead time will be changed. After the DEAD time is changed, the HELLO time will not be changed. Repeat the negotiation process of the MongoDB package. The Protocol Number of the IP address header is 88. First, check the K value and AS number in your HELLO bag for the same authentication. If the value is the same AS that in the neighbor table, UPDATE the package to send route updates, QUERY the neighbor's route information, REPLY, respond to the neighbor's request, ACK, and confirm the reliable package. OSPF package: one DOWN state indicates that the two Inite states are not yet available. It indicates that the HELLO package starts to be switched at the first time. The two routers of AB, A, do not know that B is its neighbor, so I sent it to B. B reported the four fields in HELLO, added A to his neighbor table, and sent A HELLO packet to. Three TWO-WAY state when A or B detects that the HELLO packet sent by the other party has its own, A TWO-WAY state is formed. The TWO-WAY state is also preemptible. TWO-WAY is a bidirectional connection, indicating that the neighbor relationship has been established. Select DR/BDR for TWO-WAY state. The four Exstart state is used to exchange the DBD data packet and select the master-slave relationship. Detect MTU. Starting from the first DBD package, it indicates that the adjacent State is established. The first DBD package does not contain the LSA header, and each subsequent package contains the LSA header. If the DBD package I sent you does not have the LSA header, you will request (LSR) from me, and then I will send you the real LSU. After you receive LSU, You need to respond to my LSACK. For example: www.2cto.com
For example, you want to get married with your girlfriend at the wedding agency. First, call the wedding introducers to establish a good relationship with the neighbors. Then the wedding introducing Institute will introduce you to the girl's information, the first girl from Shanghai, how are people, and some basic information. The second foreigner, how are people, students, and students here. Basic information. This is the header information in DBD. Then you are very interested in receiving the basic information about DBD. Then you need to ask me for details about it. This is LSR. For example, what is the girl's phone number, how to make an appointment. The detailed information. So this time the wedding introducers will tell you the details. This is the real LSA in LSU, and I will tell you all the information, however, the information provided by the wedding introducers is not all free of charge. You must pay the service fee, LSACK, to confirm the information. Five Exchange States Exchange DBD, And the LSU six Loading State puts itself into the topology table for calculation. 7. Full state indicates that the joining relationship has been formed. The DBD package contains the first DBD package of three digits for negotiation of the master-slave relationship. Dbd I m/S1 1 1 I bit represents the first enable bit. When you are the first package, it is 1 and the subsequent package is 0. The M-bit is the successor, or you can understand it as more. If this is not the last package, it is 1, and if it is the last package, it is 0. The M/S bit is called the master/slave bit and the master/slave bit. At first, I didn't know others, nor did I know me. I thought I was the boss. At first, I was the master, so 111 is 7, so the initial flag is 7. You can use debug to check it: * Mar 1 05:28:30. 366: OSPF: Rcv DBD from 2.2.2.2 on Serial1/0 seq 0xEC2 opt 0x52 flag 0x7 len 32 mtu 1500 state INIT * Mar 1 05:28:30. 366: OSPF: 2 Way Communication to 2.2.2.2 on Serial1/0, state 2WAY * Mar 1 05:28:30. 370: OSPF: Send DBD to 2.2.2.2 on Serial1/0 seq 0x888 opt 0x52 flag 0x7 len 32 www.2cto.com there are two validation methods in OSPF, one is display confirmation and the other is implicit display confirmation. Display confirmation means that there is a separate package dedicated for validation, which is used for validation when the EIGRPACK package is used. In ospf, there is an LSACK dedicated for LSU validation. DBD is called implicit confirmation. That is to say, the seq 0x104c of the sent DBD package is the same as that of the seq 0x104c, And you have received your package. Who is the same as the master. Select the master-slave relationship: Use rotuer-id to select the master-slave relationship. The master node with a large router-id and the slave node with a small router-id. The interface address size is also used. The interface address is mainly large, and the interface address is small as slave. For example, if the ports on both sides are not on the same CIDR block, and the subnet mask is different, can we establish a neighbor relationship? What is written on Volume 1 cannot be complete or is incomplete. Sometimes, yes. For example, R1 s1/0 ------------------ R2 s1/0R1: int s1/0 R2: int s1/0 ip add 10.0.0.1 255.0.0.0 ip add route router ospf 1 rotuer ospf 1 router-id 1.1.1.1 router-id 2.2.2.2 netw 10.0.0.0 0.255.255.255 a 0 netw 10.0.0.0 0.0.255 a0r1 # sh ip ospf neiNeighbor pri State Dead Time Address Interface2.2.2.2 0 FULL/-00:00:33 10.0.0.2 Serial1/0r2 # sh ip ospf neiNeighbor ID Pri State Dead Time Ddress Interface1.1.1.1 0 FULL/-00:00:31 10.0.0.1 Serial1/0 now let's take a look at the effect of MTU on OSPF. There are two types of MTU: MTU, one is that the ip mtumtu is a layer-2 capacity concept, which refers to the location of the layer-2 for the layer-3, that is, when your layer-3 data packets come down, it cannot exceed. The MTU of Layer 2 is 1500 bytes. Ip mtu is a three-tier summary concept, that is to say, I put the three-tier package into your two-tier package, that is, what is my interface multipart package. The ip mtu is limited by MTU. By default, the layer 3 is the same as the Layer 2. MTU is 1500 bytes. Sh int s1/0 check Interface Layer 2 Information www.2cto.com sh ip int s1/0 check Interface Layer 3 information will compare MTU at the time of establishing the adjacent, MTU on both sides must be the same. The MTU modification has no effect on the establishment of the adjacent vertex. For example, R1 s1/0 ------------------ -------- R2 s1/0R1: int s1/0 R2: int s1/0 ip add 10.0.0.1 255.255.255.0 ip add router ospf 1 rotuer ospf 1 ip mtu 1300 router-id 2.2.2.2 router-id 1.1.1.1 netw 10.0.0.0 0.0.0.255 a 0 netw 10.0.0.0 0.0.255 a 0 255.r1 # sh ip ospf neiNeighbor ID Pri State Dead Time Address Interface2.2.2. 2 0 EXSTART/-00:00:38 10.0.0.2 Serial1/0r2 # sh ip ospf neiNeighbor ID Pri State Dead Time Address Interface1.1.1.1 0 EXSTART/-00:00:37 10.0.0.1 Serial1/0 restart it ignores MTU comparison. Int s1/0ip ospf mtu-ignore statement input above mtu. The creation is successful. (Do not create) www.2cto.com r1 # sh ip ospf nei Neighbor ID Pri State Dead Time Address Interface2.2.2.2 0 FULL/-00:00:37 10.0.0.2 Serial1/0OPSF package is related to the package size of Layer 3, it has nothing to do with Layer 2. Maintaining routing information we just tested that the serial port sent 224.0.0.5 at the direct side. In the multi-access link, DR is selected. All BDR devices are adjacent to DR and BDR devices, and LSU is switched between them. The address that all routers send to dr bdr is 224.0.0.6. All dr bdr data is sent to other routes at 224.0.0.5. for example, this link is equivalent to a village, and DRBDR is equivalent to the village chief and deputy village chief. The village chief and deputy village chief live in the village committee office. The other villagers are 224.0.0.6, DRother stays outside. They are 224.0.0.5. The villagers are going to look for the village chief. They are going to go to 224.0.0.6. The deputy village chief of the village chief will go down to 224.0.0.5 for the inspection work. How can I choose a village chief or deputy chief? The wait-time wait time is set by. That is to say, at first, everyone is a village chief. For example, if there is a person, how long has no one opposed it as a village chief, that is, the village chief. This time is the same as the Dead time. R2 # sh ip ospf int s1/0Serial1/0 is up, line protocol is up Internet Address 192.168.12.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, retransmit5 oob-resync timeout 40 Hello due in 00:00:04 Supports Link-local Signaling (LLS) Index 1/1, flood queue length 0 Next 0x0 (0)/0x0 (0) last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 4 msec Neighbor Count is 1, adjacent neighbor count is 1 Adjacent with neighbor 1.1.1.1 Suppress hello for 0 neighbor (s)
The modification time of Dead will change accordingly. The network type of the serial port is that the network type of the point-to-Ethernet port is broadcast www.2cto.com 2 priority. The default priority is 0. The higher the ip ospf priority (0-255) priority under the interface, the easier it is to become a village chief. When the priority is 0, no election is performed. 3. router-id. The name of the router-id must be the village chief. So where did our router-id come from? The first is manually specified, and the second is the largest physical interface address if no loopback port is available. If there is loopback port, it is the loopback interface address. In a multi-access network, the subnet mask must be the same. If a 255-priority route is added to the network where I originally had a DR-BDR, it is impossible to seize the DR-BDR role. When DR disappears, BDR immediately becomes DR. The 255 priority person can now become BDR. After creating a neighbor, you can send the DBD to the neighbor. The DBD contains the LAS header. If you are interested, you can send the LSR as I do, if I receive this LSR, I will send this LSU to you. The LSU machine contains the real LSA. Finally, you will receive this LSU and send me an LSACK. The LSACK contains the LSA header. After receiving the LSA, It will be placed in its own LSDB. The serial number is used to compare the LSA. The serial number is 32 bits and is expressed in 4 bytes. From 0x80000001 to 0x7fffffff.
View r1 # sh ip ospf database OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 0) link id adv Router Age Seq # Checksum Linkcount1.1.1.1 1.1.1.1 1086 0x80000005 0x0048DB 22.2.2.2 2.2.2.2 1091 0x80000007 0x0034E0 2 Net Link States (Area 0) link id adv Router Age Seq # Checksum192.168.12.2 2.2.2.2 1092 0x80000005 0x008723 each region has its own database. within the same region, all the routes share the same database. Www.2cto.com
When using a database, pay attention to the following areas: Area 1, type 2, 3 Link ID, 4 ADV Router 5 age aging time because OSPF is periodically updated, it is updated every 30 minutes. Why is it updated every 30 minutes? If periodic updates are not defined, the update will be useless and will expire. What time does it expire when its age time exceeds 3600 seconds. When it is aging, I will flood it once, and Add 1 to the serial number. This serial number will always be sent at 7fffffff time in one day. It will send a 0x7fffffff with an age of 3600 seconds. After receiving the serial number, you will Delete this entry. No matter how many times it will be sent to you next time, you will receive it. I'm sending an identical entry from 0x80000001. This is the combination of the serial number and AGE time. Author's world wide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.