OSPF dynamic routing protocol (theory part) theoretical knowledge succinctly


OSPF (Open Shortest Path First Open Shortest Path First) is an interior gateway protocol (Interior Gateway Protocol, referred IGP), for a single autonomous system (autonomous system, AS) the routing decision. Is a link state routing protocol implemented under the Interior Gateway Protocol (the IGP), so that the operation of the internal autonomous systems. The famous Dick Alaska algorithm is used to calculate the shortest path tree. OSPF supports load balancing and routing based on type of service, also supports a variety of routing forms, such as a particular host routing and subnet routes and so on. OSPF routing protocol is a typical link-state (Link-state) routing protocol, generally used in the same routing domain. Here, the routing domain refers to an autonomous system (Autonomous System), i.e. the AS, which refers to a set of network exchange routing information through a unified policy routing protocol or routing each other. In the AS, all OSPF router maintains a database describing the AS same structure, which is stored in the database information of the corresponding link state routing domain, OSPF router which is calculated by the OSPF routing table database of.

Main points:

Routes into types: DR, BDR, ABR, ASBR

Five regions: the backbone area, the standard area, peripheral area, fully distal region, the distal region of the non-existence
of the five packet types: Hello, the DBD, the LSR, the LSU (the LSA), the LSAck of
six kinds of the LSA: LSA1, LSA2, LSA3, LSA4, LSA5 , LSA7
seven states: Down state, Init state, 2-Way state, ExStart state, Exchange state, Loading state, Full state

And Interior Gateway Protocol Exterior Gateway Protocol:

Before OSPF understand the principles we first need to know some related concepts:
(1) autonomous system (AS)
(2) Interior Gateway Protocol (IGP), such as: RIP, OSPF, ISIS protocol.
(3) External Gateway Protocol (EGP), such as: BGP protocol.

OSPF working process:

First, the router will establish an adjacency with each other, after the neighbor relationship is established will learn link state information with each other, after learning link status information will generate a link state database, and then calculates the shortest path tree by Dijkstra algorithm, the shortest path to integrate all into the routing table.

OSPF routing in four:

DR (Designated Router): After the designated router, OSPF protocol to start from the beginning of the election. In order to solve the LSA is a great waste of bandwidth in a Area in the design, when a router port has changed or is damaged, then the router will directly inform the DR, and DR will be informed of all routes in the area.

BDR (Back-up Designated Router) : backup designated router, also came after the election started by OSPF. Its role is to work instead of DR in the DR does not work.

ABR (Area Border Routers): an area border router that couples various OSPF area. ABR is established as a region of each connecting link state database, the connection region is responsible for sending the summary information to the backbone routing area, the core area and ABR is responsible to send this information to the respective zone.

ASBR (Autonomous System Boundary Router): autonomous system border router, is positioned between and non-OSPF OSPF network. In a router between two AS, is mainly used to transfer route between the two autonomous systems.

OSPF dynamic routing protocol (theory part) theoretical knowledge succinctly

The above is a simple diagram may be seen between different regions ABR (Area) of the border router, the ASBR routers border between different autonomous systems (AS). The DR and BDR routers between each segment, I only marked the Area 1 regional network of DR and BDR, in fact, that each segment has its own elected DR and BDR depending on the circumstances. Note: a router can simultaneously serve multiple roles, may be DR, ABR, ASBR at the same time.

DR and BDR election method:

Before the election the way we need to talk, first look Router ID. Router ID is an IP address uniquely identifies the area within the OSPF routers. Router ID loopback interface generally selected router IP address of the highest value; if no loopback interface, to select the highest IP address in the physical interface; or we can use the router-id command directly specifying the Router ID.
(1) automatically elected
Router ID of the router on the network is elected maximum DR, and the second largest is elected as the BDR. Router ID is the format of an IP address, an IP address is generally aa.bb.cc.dd, if we compare the size generally is from aa than, if not as big, large direct selection; if as large, then the comparison continues bb , cc, dd comparison until the size, large selection.

(2) manually select
we can set the priority of the router to set the DR, BDR. Priority range is 0 to 255. The higher the value the priority of a general default. If the priority is the same, the need to compare any Router ID. If the router priority is set to 0, it will not participate in the election of DR and BDR.

Note: After the DR and BDR election between the general segment is completed, the greater the original DR and BDR If you add a new subnet router Router ID than that, it will not replace the existing DR and BDR. The OSPF after the system starts, if there is no access to the new equipment will start in the 40s elections. It is generally in the real world, the first router configuration is automatically elected as the DR, the second for the BDR.

(3) OSPF multicast address

(4) OSPF metric COST

COST = 8 th / BW 10 (bandwidth)

(5) OSPF packets
carried within IP packets using the protocol No. 89

OSPF area:

To accommodate large networks, OSPF plurality of divided regions in the AS. Each OSPF router maintains a complete link-state information in your area. Each region has a region ID, you can be represented as a decimal number, it may be expressed as an IP. Each region like a separate network, OSPF routers saved only in the region of the link-state region. Each router link state database can maintain a reasonable size, route calculation time, reported the number of text will not be too large.

The backbone (Area0): backbone area must connect all non-backbone areas, the backbone region and indivisible, and only one, in general, not the end user backbone area. Other areas are non-backbone area, non-backbone area classified into four categories.
Standard areas: non-backbone area is generally divided according to actual conditions, must be connected to the backbone area (irregular region also need to be connected to the backbone through the tunnel, or virtual-link). In general, the region's main backbone connection fee to end users and resources.
Peripheral area (stub Area): keep the peripheral region is a region does not accept routing information outside the autonomous system. If you need to route outside the autonomous system, it uses the default route
Totally peripheral area (Totally stubby Area): it does not accept the route summary routes and other areas within the AS external autonomous system. We need to send messages to the outside area of the default route: Cisco's own peripheral region is completely defined.
Non storage peripheral region (NSAA): it is similar to the tip storage area, but allows the receiver to the external routing information transmitted LSA Type 7, and should be converted into 7 LSA Type LSA Type 5.

OSPF packet types:

(1) Hello packet: 10 seconds transmission time, the time of death 40s, four times the fixed relationship may also be modified. Used to discover and maintain neighbor relationship and to elect DR and BDR.
(2) the database description packets (DBD: Database Description): it is just a conceptual description of the local database, for checking that the router database synchronization.
(3) Link state request packets (LSR: Link-State Request) : Request link status in the database synchronization process, after receiving the router DBD contains new information transmission, a request for more detailed information.
(4) Link State Update packet (LSU: Link-State Update) : link state update, LSU include several types of the LSA, LSU responsible flood LSA, and the corresponding LSR. Before LSA sent only at the request of the LSA LSR directly connected neighbors, flooding, when the neighbor is responsible for the routing information received LSA re-packaged in the new LSU.
(5) the link state acknowledgment packet (LSACK): link state confirmation, confirmation of the router LSA must be LSAck each received acknowledgment LSAck but can be a plurality of LSA.

OSPF status:

(1) Down state
(2) Init state: sending the Hello packet
(3) Two-way Status: interface receives a Hello packet and the reply packet including its Hello-ID Router
(. 4) the Exstrart Status: First DBD main confirmation slave relationship, router-id large main, the first contract
(5) Exchange status: DBD learn to interact with each other
(6) Loading status: LSR of interaction with LSU
(7) Full status: interaction is complete

The first phase is to start using OSPF Hello packets to establish two-way communication process:

OSPF dynamic routing protocol (theory part) theoretical knowledge succinctly

OSPF start of the second phase is to establish full adjacency:

OSPF dynamic routing protocol (theory part) theoretical knowledge succinctly

注意:在Two-Way状态下会选出两个Router ID最大的路由器,但不会确定DR和BDR。DR和BDR是在ExStart状态下确定的。


(2)广播多路访问网络(Broadcast MultiAccess,BMA)
(3)非广播多路访问网络(None Broadcast MultiAccess,NBMA)


LSA Type 1:LSA 1是由区域内的路由器发出的LSA,类型为路由器LSA(router LSA)。描述本区域路由器链路到该区域的状态和代价(cost)。一个边界路由器可能产生多个LSA 1。

LSA Type 2:由区域内DR发出,类型为网络LSA(network LSA)。含有连接某个区域路由器的所有链路状态和代价信息。只有DR可以监测该信息。

LSA Type 3:由ABR发出,类型为网络汇总LSA(summary LSA)。含有ABR与本地内部路由器连接信息,可以描述本区域到主干区域的链路信息。它通常汇总缺省路由而不是传送汇总的OSPF信息给其他网络。

LSA Type 4:由ABR发出,类型为ASBR汇总LSA(Summary LSA)。由主干区域发送到其他ABR, 含有ASBR的链路信息,与LSA 3的区别在于LSA 4描述到OSPF网络的外部路由,而LSA 3则描述区域内路由。

LSA Type 5: emitted from an ASBR, AS external LSA type containing information about the link outside the autonomous (AS External LSA.). In addition to the distal region and a distal region completely, LSA Type 5 transmitted across the network.

LSA Type 7: issued by the ASBR in the NSSA, NSSA type external LSA (Not-So-Stubby LSA ). External routing information contained on the NSSA connection. LSA 7 can be converted to LSA 5.

Three OSPF traffic:

Domain traffic (Intra-Area Traffic)

Traffic packets constituting exchanged between routers within a single area.

Inter-domain traffic (Intra-Area Traffic)

Traffic packets constituting exchanged between routers in different regions.

External traffic (External Traffic)

Outer area OSPF router of OSPF domain between the other routers in the autonomous system to exchange traffic data packet or configuration.

Common OSPF check command:

show ip route                                                     //查看路由表信息(直连/学习)

show ip route ospf                                            //只查看OSPF学习到的路由

show ip protocol                                              //查看OSPF协议配置信息

show ip ospf                                                     //查看OSPF是如何配置的以及ABR的信息

show ip ospf database                                   //查看LSDB内的所有LSA数据信息

show ip ospf interface                                    //查看接口上OSPF配置的信息

show ip ospf neighbor                                   //查看OSPF邻居和邻接的状态

show ip ospf neighbor detail                       //查看OSPF邻居的详细信息(包括DR/BDR)

show ip ospf adj                                            //查看路由器“邻接”的整个过程

show ip ospf packet                                     //查看每个OSPF数据包的信息

clear ip route                                                //清空路由表

(Specific experimental demonstration, I will write the next one blog)

Guess you like

Origin blog.51cto.com/14449541/2439807