Concept and working principle of OSPF routing protocol (1)

Source: Internet
Author: User

1. Overview

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), 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 LSALink State Advertisement of the link status broadcast packet to all routers in a region, which 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.

2. data packet format

The packet header of an OSPF route protocol is 24 bytes long and contains the following eight fields:

* Version number-defines the Version of the OSPF routing protocol used.
* Type-defines the OSPF Packet Type. There are five types of OSPF data packets:
* Hello-is used to establish and maintain the relationship between two adjacent OSPF routers. This packet is sent periodically.
* Database Description-describes the entire Database. This packet is sent only when OSPF is initialized.
* Link state request-Requests part or all of the data to the adjacent OSPF router. This type of data packet is sent only when the router finds that its data has expired.
* Link state update-this is the response to the link state request packet, that is, the LSA packet.
* Link state acknowledgment-is the response to the LSA data packet.
* Packet length-defines the length of the entire data Packet.
* Router ID-used to describe the source address of a data packet, expressed as an IP address.
* Area ID-used to identify the Region ID of an OSPF Packet. All OSPF packets belong to a specific OSPF region.
* Checksum-check bit, used to mark data packets with no error code during transmission.
* Authentication type-defines the OSPF Authentication type.
* Authentication-contains OSPF Authentication Information, which is 8 bytes long.

3. OSPF basic algorithm

3.1 SPF algorithm and shortest path tree

The SPF algorithm is the basis of the OSPF routing protocol. The SPF algorithm is also known as Dijkstra algorithm, because the Shortest Path Priority Algorithm SPF was invented by Dijkstra. The SPF algorithm uses Each router as the ROOT) to calculate the distance from the router to each destination. Each router calculates the topology of the routing domain based on a unified database accounting structure, which is similar to a tree, in the SPF algorithm, it is called the Shortest Path Tree. In the OSPF routing protocol, the trunk length of the shortest path tree, that is, the distance from the OSPF router to each destination router, is called the OSPF Cost. Its algorithm is: Cost = 100 × 106/link bandwidth.

Here, the link bandwidth is expressed in bps. That is to say, the Cost of OSPF is inversely proportional to the bandwidth of the link. The higher the bandwidth, the smaller the Cost, which indicates the closer the OSPF to the destination. For example, the Cost of FDDI or fast Ethernet is 1, the Cost of 2 m serial link is 48, and the Cost of 10 M Ethernet is 10.

3.2 link status Algorithm

As a typical link-State routing protocol, OSPF must follow the Unified Algorithm of The Link-State routing protocol. The Link State algorithm is very simple. Here, the link state algorithm is summarized into the following four steps:

When a vro is initialized or the network structure changes, such as adding or removing a vro or changing the link status), The vro generates a link status broadcast packet LSALink-State Advertisement ), this packet contains the status information of all connected links on the router, that is, the status information of all ports.

All routers exchange link status data through a method called refresh Flooding. Flooding refers to the router that transmits its LSA data packet to all OSPF routers adjacent to it. The adjacent router updates its database based on the received link status information, the link status information is sent to the adjacent router until it is stable. When the network becomes stable again, it can be said that when the OSPF routing protocol converges, all routers calculate their route tables based on their respective link status information database. The routing table contains the router to each Cost that can reach the destination and the next router next-hop to be forwarded to the destination ).

The 4th step is actually a feature of the OSPF routing protocol. When the network status is stable, the link status information transmitted in the network is relatively small, or it can be said that when the network is stable, the network is relatively quiet. This is also a major difference between link status routing protocols and distance vector routing protocols.

4. Basic Features of OSPF Routing Protocol

The above section describes that the OSPF routing protocol is a link-State Routing Protocol. To better illustrate the basic features of the OSPF routing protocol, we compare the OSPF routing Protocol with RIPRouting Information Protocol, one of the Distance Vector routing protocols, into the following points:

The unique parameter used to represent the distance of the destination network in the RIP routing protocol is HOP), that is, the number of routers to be routed to the destination network. In the RIP routing protocol, this parameter is limited to a maximum of 15, that is, the RIP route information can be transferred to up to 16th routers. For the OSPF routing protocol, the routing table indicates that the destination network parameter is Cost, which is a virtual value and is related to the bandwidth of links in the network. That is to say, OSPF route information is not limited by the number of physical hops. In addition, the OSPF Routing Protocol also supports TOSType of Service) routing. Therefore, OSPF is suitable for large networks.

The RIP routing protocol does not support variable-length subnet shielding code VLSM), which is considered another important reason why the RIP routing protocol is not applicable to large networks. The variable-length subnet shielding code can save IP addresses to the maximum extent. The OSPF routing protocol provides excellent support for VLSM.

The route convergence of the RIP routing protocol is slow. The RIP route protocol periodically broadcasts the entire route table to the network as route information. The broadcast period is 30 seconds. In a relatively large network, the RIP Protocol generates a large amount of broadcast information, occupying a large amount of network bandwidth resources. In addition, due to the 30-Second Broadcast cycle of the RIP Protocol, affects the convergence of the RIP routing protocol, and even does not converge. OSPF is a link-based routing protocol. When the network is stable, there is little routing information in the network, and its broadcast is not cyclical, therefore, OSPF routing protocols can quickly converge even in large networks.

In the RIP Protocol, a network is a plane and has no region or boundary. With the advent of CIDR, the RIP Protocol is obviously outdated. In the OSPF routing protocol, a network, or a routing domain, can be divided into multiple area areas. Each area is connected through an OSPF border router, and a Summary of the Summary between regions can be obtained through routing) to reduce route information, route tables, and improve the operation speed of the router.

The OSPF routing protocol supports route verification. Only routers that pass route verification can exchange route information. In addition, OSPF can define different verification methods for different regions to improve network security.

The OSPF routing protocol provides better support for load balancing. The OSPF routing protocol supports load balancing on multiple Cost links. Currently, some manufacturers' routers support load balancing on six links.

5. region and Inter-Domain Routing

AS mentioned above, in the definition of OSPF routing protocol, a routing domain or an autonomous system AS can be divided into several regions. In OSPF, a set of networks or routers that are combined according to certain OSPF routing rules is called a region AREA ).

In the OSPF routing protocol, the routers in each region calculate the network topology according to the link state algorithm defined in the region, this means that each region has an independent network topology database and network topology. The network topology of each region is invisible outside the region. Likewise, the vrouters in each region do not know the other network structures outside the region. This means that the network link status data broadcast in the OSPF route domain is blocked by the border of the region. This helps reduce the broadcast of link status data packets in the network, this is also an important reason why OSPF divides its routing domain or an AS into multiple regions.

With the introduction of the concept of region, it means that no longer all routers in the same AS have the same link status database, but the router has the link status information of each region connected to it, that is, the structure database of the Region. When a router is connected to multiple regions, it is called a regional border router. A vbr in a region has the network structure data of all zones connected by itself. Two routers in the same region have the same structure database for this region.

We can divide routes in the OSPF routing domain into two types based on the destination address and Source Address of the IP packet. When the destination and source address are in the same region, they are called intra-region routes, when the destination and source address are in different regions or even different AS, we call it Inter-Domain Routing.

OSPF backbone areas and Virtual-link)

There is a Backbone region Backbone in the OSPF routing protocol. This region includes networks in this region and corresponding routers. The Backbone region must be continuous, the other regions must be directly connected to the backbone areas. The backbone area is generally Region 0, and its main task is to transmit route information between other regions. The network structure between all regions, including the backbone areas, is invisible. When the routing information of a region is broadcast externally, the route information is first transmitted to Region 0 (backbone region), and then broadcast the route information to other regions by Region 0.

In the actual network, the backbone may be discontinuous or the physical connection between a certain area and the backbone area may not exist. In both cases, the system administrator can set virtual links.

A virtual link is set between two routers. Both routers have a port connected to the same non-backbone area. The virtual link is considered to belong to the backbone area. In the OSPF routing protocol, two routers at both ends of the virtual link are connected by a point-to-point link. In the OSPF routing protocol, the routing information of virtual links is viewed as intra-domain routing. The following describes the role of a virtual link in the OSPF Routing Protocol in two cases.

1. When a region and area0 have no physical link

As mentioned above, Area 0 must be in the center of all regions, and all other regions must be directly connected to the backbone areas. However, there is also the possibility that a region cannot establish a physical link with a backbone region. In this case, we can use a virtual link. A virtual link establishes a logical connection point between the region and the backbone region. The virtual link must be established between two regional border routers, and one of the regional border routers must belong to the backbone region.

In the example shown above, Region 1 and Region 0 have no physical connection links. We can establish A virtual link between router A and router B. In this way, use Region 2 as a Transit-network, and vrob B as the Access Point. region 1 establishes a logical connection with Region 0.

2. When the backbone area is not continuous

The OSPF Routing Protocol requires that the backbone region area0 be continuous, but the backbone region may be discontinuous. For example, if we want to mix two OSPF routing domains, in addition, if you want to use a backbone area, or when some routers fail to cause disconnections in the backbone area, we can use a virtual link to connect two non-contiguous areas 0. At this time, the two ends of the virtual link must be the vbrs of the two regions, and both vrouters must have ports in the same region.

In the preceding example, two half-backbone areas are connected through the virtual link in area 1, and the routing information between router A and router B is processed as the OSPF route.

In addition, virtual links cannot be used when a non-backbone area is split into two halves. In this case, one of the split regions will be processed by other regions as Inter-Domain routes. Residual field Stub area)

In the link status database of OSPF routing protocol, information about the AS external link status is transmitted to all OSPF routers in the AS through flooding. However, there is such a region in the OSPF routing protocol. We call it the residual region stub area). AS external information cannot be broadcasted into/out of this region. For the residual domain, data accessing the external AS can only be addressed according to the default route default-route. This helps reduce the size of the link status database and the usage of the memory on the vro of the residual domain, and increase the speed at which the vro calculates the route table.

When an OSPF region has only one exit point, We can configure this region as a residual region. At this time, the VBR in this region broadcasts the default route information to the region. Note that all routers in a residual domain must know that they belong to the residual domain. Otherwise, the setting of the residual domain does not work. In addition, there are two points for the residual domain: first, virtual links are not allowed in the residual domain, and second, AS border routers are not allowed in the residual domain.


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.