Overview of OSPF Routing Protocol

OSPF routing protocol           OSPF configuration commands

1, basic overview
    1, neighbor routers: routers located on the same physical link or physical network segment

    2, link state database: also known as topology database, it contains all routers. Links to routers and the state of those links, also all networks and all paths to those networks
    3, Adjacency: When the link state databases of two neighboring routers running OSPF It is completely adjacency

    4. A router running the RIP routing protocol only needs to save one routing table, while a router using the OSPF routing protocol needs to save the following three tables
        . Neighbor list: List all adjacent routers that each router has established an adjacency relationship with
        Link State Database (LSDB): List other router information in the network, thus showing the network topology of the whole network
        Routing table: List the best path to the network connected to each item calculated by the SPF algorithm

    △OSPF It is a link-state
    routing protocol that does not cause loop problems, so there is no need to use restrictions such as the maximum number of hops to prevent loops. Internally learn the complete link state information, without having to know all the link states in the entire AS.

Second , Router ID
    1, because the router running OSPF needs to know which router each link is linked to. Therefore, it needs to be configured by A unique representation to mark a router in an OSPF network, this representation becomes the Router ID.
    2. The Router ID is the only IP address representing the router in the OSPF area. Cisco routers advertise the following methods to get their Router ID.
    3. First, the router selects the IP address with the highest value on all its Loopback interfaces.
    4. If the router is not configured with an IP address for Loopback, then the router selects an IP address with the highest value among all active physical ports as the Router ID of the router. The router interface used as the Router ID does not necessarily have to run the OSPF protocol.
    5. The main advantage of using the loopback interface as the router ID is that the loopback interface is more stable than any other physical port, and the router must be successfully started.
    6. In the OSPF protocol, the router-id command can be advertised to specify the router ID of the router, so the network administrator can configure the router ID value of
    7, which is easy to remember. When configuring OSPF in the actual project, it is necessary to manually specify the router ID of the router. has become a standard configuration.

Three, DR and BDR
(1), the concept of DR and BDR
    DR: Designate a router, designate a router to connect with other routers in the network, and be responsible for informing them of changes on the network segment
    BDR: Backup designated routers, when designated routers When it fails, the backup designated router takes effect and replaces it.

(2) The election of
    DR and BDR can be automatically elected by OSPF, or 1 can be manually selected

to automatically elect DR and BDR
    The router with the largest router ID on the network segment will be elected as the DR, and the second largest router will be elected as the BDR. Such election results may not be optimal. For example, if the network segment consists of Cisco 7200 and 3800 series routers, then 3800 The router may be elected as DR

2 due to the large Router ID.
    To manually select DR and BDR, you need to manually select DR and BDR, and you need to set the priority of the route. Each router interface has a route priority, (Router Priority), It is represented by an 8-bit unsigned integer. The size ranges from 0 to 255. The larger the value, the higher the priority. The default priority on Cisco routers is 1. The interface priority can be changed by advertising the ip ospf priority command. The priority of the router is set to 0, it will not participate in the election of DR and BDR

Note : The higher the priority, the greater the probability of winning the election. If the priority is the same, you need to compare the router ID

OSPF metric:
    OSPF uses The metric value used to measure the quality of the path is called the cost (Cost), which refers to the outbound cost of the data packets sent from the interface. The link cost is represented by a 16-bit unsigned integer, and the size ranges from 1 to 65535. ,.
    The default cost used by Cisco is 10 to the 8th power/BW, which represents an integer, where BW refers to the bandwidth configured on the interface, and 10 to the 8th power is the reference bandwidth used by Cisco routers

4. OSPF adjacency

(1 ), OSPF packet type
    OSPF information does not apply to TCP or UDP, it is carried in IP packets, using protocol number 89 (decimal)
    The OSPF router protocol relies on five different types of packets to identify their neighbors and update links Status information, these five types of packets enable OSPF to have advanced and complex communication capabilities, as follows

Hello packet: used to discover and locate neighbor relationships, elect DR and BDR
Database Description Packet (DBD): used to send summary information to neighbors to synchronize the
link After the DBD of the information is sent, it is used to request more detailed information.
Link state update packet (LSU): After receiving the LSR, a link state advertisement (LSA) is sent. An LSU data packet may contain several LSA
link state confirmation packets ( LSAck): Acknowledge the receipt of LSU, each LSA needs to be confirmed separately

(2), OSPF adjacency is established
    1, failure state (Down): This is the initialization state of OSPF to establish an interaction relationship, the router does not exchange information with any neighbors
    2. Initial state (init): Each interface of the router sends Hello packets through Here, R1 sends Hello packets as an example. When the neighbor router R2 receives the first Hello packet, it enters the init state. , In this state, router R2 has received the Hello message, but its own ID does not appear in the Hello message.
    3. Two-way state (2-way): Router R2 sends a Hello response message to router R1, the The Hello response packet contains the ID of router R1. When router R1 receives the Hellp response packet and finds that it contains its own ID, it enters the 2-way state, two-way communication has been established, and the election of DR and BDR is officially in this state. completed below.
    4. Quasi-start state (ExStart):
    After the DR and BDR are elected, the router is considered to be in the ExStart state. In this state, the DR and BDR establish an adjacency relationship with other routers in the network. In this process, a master router is established between the two adjacent routers. /Slave (Master/Slave) relationship, the router with the larger ID is used as the master router to initiate communication.
    5. Exchange state (Exchange): One or more database description packets (DBD) are exchanged between the master/slave router, the router enters the Exchange state, the DBD contains the LSA entry summary information in the link state database, and the master/slave router When exchanging DBDs, make sure that both parties can receive them.

    6. Loading state (Loading):
    If the received DBD has the updated summary information of the LSA entry, the router will send a link state request packet (LSR) to the other party to request more detailed information, and the other router will use the link state update packet ( LSU) responds to the LSR, this process becomes the Loading state, and the link state update package (LSU) needs to be confirmed by the other party.

    7. Full adjacency state (Full):
    When the database synchronization between the routers is completed, their link state databases are completely consistent, and the Full state is reached at this time. At this point, the link state databases in the routers have been completely consistent. , the router can calculate the best path to the destination network through the shortest path first algorithm (SPF) according to this consistent link state database and form a routing table

(3). The network type
of depends on the physical network connected by the router. Divide the network into the following four types

1. Point-to-Point network A point-to-
    point network connects a separate pair of routers. Valid neighbors on a point-to-point network can always form an adjacency relationship. DR and BDR, the destination host of OSPF packets on these networks is always, and point-to-point generally adopts PPP protocol, HDLC protocol, etc.

2. Broadcast MultiAccess (BMA) network
    Broadcast multiple access networks, such as Ethernet and Fiber Distributed Digital Network (FDDI), etc., they can link more than two devices, and because they are broadcast , so all devices adjacent to this network can receive the transmitted packets. OSPF routers on broadcast networks will elect DR and BDR. OSPF packets are sent in multicast mode3,

and non-broadcast multi-access ( None Broadcast MultiAccess, NBMA) network
    non-broadcast multi-access, such as X.25 and frame relay, etc., can connect more than two routers, but they do not have the ability to broadcast packets, OSPF on non-broadcast multi-access networks Routers need to manually configure neighbors, elect DR and BDR, and all OSPF packets are unicast.

4. Point-to-multipoint (Point-to-MultiPoint) network
    A special configuration of point-to-multipoint network time-cost broadcast multi-access network, which can be regarded as a collection of point-to-point links, OSPF routers on these networks There is no need to elect DR and BDR, OSPF packets are multicast.

5. Features of
OSPF OSPF mainly has the following features:

1. It can adapt to large-scale networks
2. Fast convergence speed of route changes
3. No routing loops
4. Support variable length subnet mask (VLSM)
5. Support group broadcast address to send protocol packets

Guess you like