How OSPF works

Source: Internet
Author: User
Tags bit set

OSPF (Open Shortest Path First) is an Internal Gateway Protocol (IGP) used in a single autonomous system () decision routing. The link is another form of router interface. Therefore, OSPF is also known as the interface status routing protocol. OSPF establishes a link status database by notifying the status of network interfaces between routers, and generates a shortest path tree. Each OSPF router uses these Shortest Paths to construct a route table. The OSPF routing Protocol is a typical link state (Lin OSPF (Open Shortest Path First) is an Internal Gateway Protocol (IGP ), it is used to decision routing in a single autonomous system (. The link is another form of router interface. Therefore, OSPF is also known as the interface status routing protocol. OSPF establishes a link status database by notifying the status of network interfaces between routers, and generates a shortest path tree. Each OSPF router uses these Shortest Paths to construct a route table. OSPF is a typical Link-state routing protocol. It is generally used in the same routing domain. Here, a routing domain refers to an Autonomous System (Autonomous System), that is, AS, which refers to a group of networks that exchange route information through a unified routing policy or routing protocol. In this AS, all OSPF routers maintain a database that describes the AS structure and stores the status information of the corresponding link in the routing domain, the OSPF router uses this database to calculate its OSPF route table. As a routing protocol for Link status, OSPF transmits the Link status broadcast packet LSA (Link State Advertisement) to all routers in a region, this is different from the distance vector routing protocol. A router running the distance vector routing protocol Transmits some or all route tables to its adjacent routers. 1. OSPF Packet type: 1 HELLO 12 Database Description DBD reliability 3 Link-state Request Link status Request package LSR reliability 4 Link-state Update Link status Update package LSU reliability 5 Link-state Acknowledment Link status confirmation purpose of the LSACK1.Hello protocol: 1. used to discover neighbors 2. before becoming a neighbor, you must negotiate the parameters in the Hello packet. the Hello packet plays the keepalive role among neighbors. 4. allow two-way communication between neighbors 5. it selects DR and bdr on the Nonbroadcast Multi-access network (30 s by default in NBMA, 10 s by default for multiple access and 10 s for point-to-point network. hello Packet contains the following information: 1. source router RID2. source router Area ID3. source router interface Mask 4. source router interface authentication type and authentication information 5. the sending interval of the Hello packet of the source router interface is 6. invalid time interval of the source router interface 7. priority 8.DR/ BDR9. five flag bits (flag bit) 10. the network type of the source router's all neighbors. The following are five network types defined by OSPF: 1. A point-to-point network, such as line T1, is a network connected to a single pair of routers. Valid neighbors on a point-to-point network can always form an adjacent relationship. In this network, the destination address of the OSPF package is 224.0.0.5. This multicast address is called AllSPFRouters.2. broadcast network, such as Ethernet, Token Ring, and FDDI. a dr and BDR will be elected on such network, the destination address of the OSPF Packet sent by DR/BDR is 224.0.0.5, And the destination MAC address of the frame carrying the OSPF Packet is 0100.5E00.0005; in addition to DR/BDR, the destination address of the OSPF package is 224.0.0.6, which is named AllDRouters. 3. NBMA networks, such as X.25, Frame Relay, and ATM, do not have the broadcast capability. Therefore, the neighbors must manually specify the network to elect DR and BDR, the OSPF package adopts the unicast mode. 4. A point-to-multiple-point network is a special configuration of the NBMA network and can be seen as a collection of point-to-point links. do not select DR and BDR.5. virtual links on such networks: OSPF packets are sent in unicast mode and can be classified into two network types: 1. transmission Network (Transit Network) 2. the status of the ospf dr and BDROSPF routers in the Stub Network (Stub Network) 3 before they are completely adjacent: 1. down: initialization status. 2. attempt: only applicable to the NBMA network. In the NBMA network, the neighbor is manually specified. In this status, the router replaces PollInterval with HelloInterval to send the Hello packet. 3. init: indicates that He is received in DeadInterval. Llo packet, but 2-Way communication is still not established. 4. two-way: two-way session creation. 5. exStart: the initial state of information exchange. In this state, the local router and the neighbor will establish a Master/Slave relationship, and determine the DD Sequence Number. If the interface level is high, they will become Master.6.Exchange: Information exchange status, the local router sends the database description package to the neighbor and sends the LSR to request the new LSA.7.Loading: Information loading status. The local router sends the LSR to the neighbor to request the new LSA. 8. full: it is in the completely adjacent State, which appears in the Router LSA and Network LSA. before the appearance of DR and BDR, each vro and its neighbors formed a completely mesh OSPF adjacent relationship, so that 10 adjacent relationships will be formed between the five vrouters, at the same time, 25 LSAs will be generated. in addition, in a multi-access network, the LSA sent by itself is sent back from the neighbor's neighbor, resulting in many copies of the LSA on the network. In this case, DR and BDR are generated. DR will do the following: 1. describes the multi-access network and other related routers on the network. 2. manage the flooding process on the multi-access network. 3. for redundancy, a bdr is also selected for Dual Backup. dr bdr selection rules: dr bdr is triggered in the form of an interface state machine. 1. each multi-access interface of a vrouter has a Router Priority. The value ranges from 0 to 255, if the default priority of a Cisco router is 1 and the priority is 0, it cannot be set to DR/BDR. the priority can be changed by killing the ip ospf priority. 2. the Hello package contains priority fields and IP addresses of interfaces that may become DR/BDR. 3. when the interface is started for the first time on a multi-channel access network, it sets the DR/BDR address to 0.0.0.0, and sets the value of the wait timer (wait timer) to be equal to the value of the router invalid (Router Dead Interval ). dr bdr selection process: 1. after establishing two-Way communication with the neighbor, check the Priority, DR, and BDR fields in the neighbor's Hello packet to list all neighbors that can participate in the DR/BDR election. all routers declare that they are DR/BDR (the value of the DR field in the Hello packet is their own interface address; the value of the BDR field is their own interface address) 2. from this list that has the right to participate in the election of DR/BDR, create a set of vrouters that do not declare themselves as DR (vrouters that declare themselves as DR will not be elected as BDR) 3. in this subset, whether or not you claim that you are a BDR, the bdr field in the Hello packet is equal to the address of your interface, and the highest priority is elected as BDR; if the priorities are the same, the highest RID election is BDR4. if the DR field in the Hello packet is equal to the address of your interface, the highest priority will be elected as DR; if the priorities are the same, the highest RID election is DR; if the selected DR If you cannot work, the newly elected BDR will become a DR and a new BDR will be elected. 5. note that after DR/BDR has been selected in the network, a new vro with a higher priority will not be re-elected 6. after the DR/BDR election is complete, DRother only forms an adjacent relationship with DR/BDR. all routers route the Hello packets to the AllSPFRouters address 224.0.0.5 so that they can track the information of other neighbors, that is, DR sends the flood update packet to 224.0.0.5; DRother only broadcasts update packet to AllDRouter address 224.0.0.6, only DR/BDR listens for this address. 4. Four phases of establishing OSPF Neighbor Relationship: 1. neighbor discovery phase 2. two-way communication phase: if both the Hello Message and the Target message are listed, the BC completes. 3. database Synchronization phase: 4. full adjacent phase: the establishment and maintenance of the full adjacency neighbor relationship are completed by the Hello packet. In the general network type, the Hello packet is sent once every time it passes through one HelloInterval., With one exception: In the NBMA network, each time a router passes through a PollInterval cycle, the Hello packet is sent to the neighbor in the down state (other types of networks do not send the Hello packet to the router in the down state ). on the Cisco router, PollInterval is sent to 224.0.0.5 as multicast by default 60 s Hello Packet. In the NBMA type, point to multi-point and virtual link network, it is unicast to the neighbor router. Neighbors can be detected through manual configuration or Inverse-ARP.

OSPF flood Flooding adopts two types of packets LSU Type 4 --- link status update packet LSA Type 5 --- link status validation packet in P-P network, the vro sends the update packet to the multicast address 224.0.0.5 in multicast mode. in a P-MP and virtual link network, the router sends the update packet to the interface address of the neighboring neighbor in Unicast mode. in a broadcast network, the DRother router can only establish an adjacent relationship with DR & BDR. Therefore, the update packet will be sent to 224.0.0.6, and the corresponding DR will receive LSA with 224.0.0.5 and BDR will only receive LSA, these updates will not be confirmed or flood, unless the DR fails in the NBMA network, LSA sends the update to the dr bdr in Unicast mode, and the DR sends the update in Unicast mode. the LSA ensures that the LSA in LSDB is the latest by serial number, checksum, and aging time. The Seq: serial number (Seq) ranges from 0x80000001 to 0x7fffffff. checksum: Checksum is used to calculate all fields except the Age field. Verify once every minute. age: The value ranges from 0 to 3600 seconds. The length is 16 bits. when the vro sends an LSA, it sets the Age to 0. When the LSA passes through one vro, an additional LSA is added to the LSDB, the aging time will also increase. when multiple instances of the same LSA are received, the following method is used to determine which LSA is up-to-date: 1. compare the serial number of the LSA instance. 2. if the serial number is the same, compare the checksum. 3. if the checksum is the same, the aging time is compared. If only one LSA has the MaxAge (3600 seconds) aging time, it is the latest. 4. if the LSA aging time differs by more than 15 minutes (called MaxAgeDiff), the shorter the aging time, the more new. 5. if the two lsws cannot be distinguished, the two lsss are considered to be the same. 5. The OSPF region is 32-bit in length and can be in decimal format. It can also be similar to the IP address's traffic in decimal format. intra-Area Traffic: Inter-Domain Traffic 2. inter-Area Traffic: Inter-Domain Traffic 3. external Traffic: External Traffic router type 1. internal Router: Internal Router 2. ABR (Area Border Router): Area Border Router 3. backbone Router (BR): Backbone Router 4. ASBR (Autonomous System Boundary Router): The Border Router of the Autonomous System. The Virtual Link must be used in the following two cases: 1. connect to a backbone area through a non-backbone area. 2. A non-backbone area is used to connect two parts of a segmented backbone area. A virtual link is a logical Tunnel. Some rules for configuring a virtual link are as follows: 1. the virtual link must be configured between two backends. 2. the region through which the virtual link passes is called Transit Area. It must have the complete route information. 3. transit Area cannot be Stub area.4. Avoid using virtual links. It increases the complexity of the network and increases the difficulty of troubleshooting. OSPF region-the essence of OSPF Link-state routing requires a hierarchical network structure during design. OSPF networks are divided into two levels: backbone or area 0. nonbackbone areas can only have one backbone area in one OSPF area, there can be multiple non-backbone areas, and the region of the backbone area is 0. Non-backbone areas cannot exchange information. They are only connected to backbone areas and exchange information through backbone areas. The routes connected between the non-backbone areas and the backbone areas are called ABRs-Area Border Routers. Only ABRs records all route tables in each region. Non-ABRs in each non-backbone area only records the route tables in the region. To connect to the routes in the external area, you can only use the ABRs in the region, connect ABRs to the BR In the backbone area, and then the BR In the backbone area to the area to be reached. The division of backbone areas and non-backbone areas greatly reduces the workload of working routes in the area. LSA type 1. type 1: Router LSA: Each Router generates a Router LSA. This LSA is only transmitted within the region and describes all the links and interfaces, statuses, and overhead of the Router. 2. type 2: Network LSA: DR generates this Network LSA in each multi-channel access Network, it only describes all routers connected to the Network LSA (including the DR itself) in the region where the Network LSA is generated ). 3. type 3: Network Summary LSA: originating from the ABR router, used to advertise the destination address outside the region. when other routers receive the Network Summary LSA from the API, they do not run the SPF algorithm. It simply adds the overhead to the API and the overhead contained in the Network Summary LSA, through ABR, the route and overhead to reach the target address are added to the routing table. This dependency is on the intermediate router to determine the full route to reach the target address (full route) it is actually the behavior of the Distance Vector routing protocol. 4. type 4: ASBR Summary LSA: The ASBR summarizes the LSA except that the advertised destination is an ASBR rather than a network. Other types are the same AS NetworkSummary LSA.5. type 5: AS External LSA: From the ASBR router, the LSA is used to advertise the destination that reaches the external destination of the OSPF autonomous system, or the external default route of the OSPF autonomous system. this LSA will flood in the whole AS 6. type 6: Group Membership LSA7. type 7: NSSA External LSA: from the incomplete Stub region (not-so-stubby area) the LSA issued by the internal ASBR router advertised that it is only flooding in The NSSA region, which is different from the LSA-Type5. opaque LSA: 8. type 8: External Attributes LSA9. type 9: Opaque LSA (link-local scope,) 10. type 10: Opaque LSA (area-local sco Pe) 11. type 11: Opaque LSA (AS scope) OSPF segments do not accept routing information outside the autonomous system, the ABR located at the Stub boundary declares a default route to all internal routers in the Stub area. region restrictions: a) All the routers in the stub area must keep the LSDB information synchronized, and they will set an E-bit (E-bit) with a value of 0 in its Hello packet. Therefore, these routers will not receive a Hello packet with an E-bit of 1, that is to say, a router that is not configured as a stub router in the stub area cannot establish an adjacent relationship with other Routers configured as stub router. b) You cannot configure virtual links in stub area, and virtual links cannot cross stub area. c) the router in stub area cannot be ASBR. the stub area can have multiple BRS, but because of the default route, the internal router cannot determine which ABR is the best choice to reach the ASBR.. Full region: routes from external autonomous systems or summarized routes from other regions of the Autonomous System (Cisco proprietary feature) are not accepted ). Secondary Area (NSSA): allows external routes to be advertised in the OSPF domain while retaining the features of the Stub Area, so ASBR can be included in the NSSA, ASBR will use the type7-LSA to advertise external routes, however, after ABR, Type7 is converted to Type5.7 LSA using a P-bit in the OSPF header for Tag. If the ABR in NSSA receives the NSSA External LSA with the P-bit set as 1, it will convert LSA type 7 to LSA type 5. and flood it to other regions; if the received NSSAExternal LSA with the P bit set to 0, it will not be converted to the LSA of type 5, in addition, the target address in LSA of Type 7 will not be declared to the external NSSA of NSSA after IOS11.2.
Author ehlopxp

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.