A router that runs a link-state routing protocol must first establish a neighbor adjacency with its neighboring routers. A router achieves this neighbor adjacency by exchanging hello packets with the neighboring routers. After neighbor adjacency is established, the neighbor is put into the neighbor database.
執行鏈路狀態路由協定的路由器,必須先與其相鄰路由器建立鄰居鄰接關係。路由器透過與相鄰路由器交換 hello 封包來建立這種鄰居鄰接關係。鄰接關係建立後,該鄰居就會被加入鄰居資料庫中。
In the example, router A recognizes routers B and D as neighbors.
在此範例中,路由器 A 將路由器 B 與 D 識別為鄰居。
After a neighbor relationship is established between routers, the routers synchronize their LSDBs (also known as topology databases or topology tables) by reliably exchanging link-state advertisements (LSAs). An LSA describes a router and the networks that are connected to the router. LSAs are stored in the LSDB. By exchanging all LSAs, routers learn the complete topology of the network. Each router will have the same topology database within an area, which is a logical collection of OSPF networks, routers, and links that have the same area identification within the autonomous system.
路由器之間建立鄰居關係後,會透過可靠地交換鏈路狀態通告(LSA),同步彼此的 LSDB(也稱為拓樸資料庫或拓樸表)。LSA 描述一台路由器以及連接到該路由器的網路。LSA 會儲存在 LSDB 中。透過交換所有 LSA,路由器就能得知網路的完整拓樸。在同一個區域內,每台路由器的拓樸資料庫都會相同;區域是自治系統內,具有相同區域識別碼的 OSPF 網路、路由器及鏈路的邏輯集合。
After the topology database is built, each router applies the SPF algorithm to the LSDB in that area. The SPF algorithm uses the Dijkstra algorithm to calculate the best (also called the shortest) path to each destination.
拓樸資料庫建立完成後,每台路由器會對該區域的 LSDB 執行 SPF 演算法。SPF 演算法使用 Dijkstra 演算法,計算到每個目的地的最佳(也稱為最短)路徑。
The best paths to destinations are then offered to the routing table. The routing table includes a destination network and the next-hop IP address. In the example, the routing table on router A states that a packet should be sent to router D to reach network X.
到目的地的最佳路徑接著會提供給路由表。路由表包含目的地網路與下一跳 IP 位址。在此範例中,路由器 A 的路由表顯示,若要到達網路 X,封包應送往路由器 D。
