21 · Introducing OSPFOSPF 簡介

Establishing OSPF Neighbor Adjacencies建立 OSPF 鄰居鄰接關係

Neighbor OSPF routers must recognize each other on the network before they can share information because OSPF routing depends on the status of the link between two routers. The Hello protocol completes this process. OSPF routers send hello packets on all OSPF-enabled interfaces to determine if there are any neighbors on those links.

相鄰的 OSPF 路由器必須先在網路上互相辨識,才能分享資訊,因為 OSPF 路由取決於兩台路由器之間鏈路的狀態。Hello 協定會完成這個程序。OSPF 路由器會在所有啟用 OSPF 的介面上傳送 hello 封包,以判斷這些鏈路上是否有任何鄰居。

The Hello protocol establishes and maintains neighbor relationships by ensuring bidirectional (two-way) communication between neighbors.

Hello 協定透過確保鄰居之間的雙向通訊,來建立並維護鄰居關係。

  • OSPF routers first establish neighbor adjacencies.OSPF 路由器首先建立鄰居鄰接關係。
  • Hello packets are periodically sent to the all OSPF routers IPv4 address 224.0.0.5.hello 封包會定期傳送到所有 OSPF 路由器的 IPv4 位址 224.0.0.5。
  • Routers must agree on certain information (*) inside the hello packet before adjacency can be established.路由器必須就 hello 封包內的某些資訊(*)達成一致,才能建立鄰接關係。

An OSPF neighbor relationship, or adjacency, is formed between two routers if they both agree on the area ID, hello and dead intervals, authentication, and stub area flag. Of course, the routers must also be on the same IPv4 subnet. Bidirectional communication occurs when a router recognizes itself in the neighbors list in the hello packet that it receives from a neighbor.

如果兩台路由器對區域 ID、hello 與 dead 間隔、驗證方式及末端區域旗標都達成一致,就會在它們之間形成 OSPF 鄰居關係(鄰接關係)。當然,這些路由器也必須位於同一個 IPv4 子網路。當路由器在其收到的 hello 封包中的鄰居清單裡辨識出自己時,就會發生雙向通訊。

Each interface that participates in OSPF uses the all OSPF routers multicast address 224.0.0.5 to periodically send hello packets. A hello packet contains the following information:

每個參與 OSPF 的介面都會使用所有 OSPF 路由器的群播位址 224.0.0.5,定期傳送 hello 封包。hello 封包包含以下資訊:

  • Router ID: The router ID is a 32-bit number that uniquely identifies the router; it must be unique on each router in the network. The router ID is, by default, the highest IPv4 address on a loopback interface, if there is one configured. If a loopback interface with an IPv4 address is not configured, the router ID is the highest IPv4 address on any active interface. You can also manually configure the router ID by using the router-id command. Even though using a loopback IPv4 address is better approach than using a physical IPv4 address for a router ID, it is highly recommended to manually set the router ID. In this way, the router ID is stable and will not change, for example if an interface goes down.路由器 ID:路由器 ID 是用來唯一識別路由器的 32 位元數字,在網路中每台路由器必須是唯一的。預設情況下,路由器 ID 是迴路介面(loopback interface,若有設定)上最高的 IPv4 位址。如果沒有設定含 IPv4 位址的迴路介面,路由器 ID 則是任一使用中介面上最高的 IPv4 位址。你也可以使用 router-id 指令手動設定路由器 ID。雖然使用迴路 IPv4 位址比使用實體 IPv4 位址作為路由器 ID 更好,但強烈建議手動設定路由器 ID。如此一來,路由器 ID 會保持穩定不變,例如即使某介面斷線也不受影響。
  • Hello and dead intervals: The hello interval specifies the frequency in seconds at which a router sends hello packets to its OSPF neighbors. The default hello interval on broadcast and point-to-point links is 10 seconds. The dead interval is the time in seconds that a router waits to hear from a neighbor before declaring the neighboring router out of service. By default, the dead interval is four times the hello interval. These timers must be the same on neighboring routers; otherwise, an adjacency will not be established.Hello 與 dead 間隔:hello 間隔指定路由器向其 OSPF 鄰居傳送 hello 封包的頻率(秒)。在廣播與點對點鏈路上,預設的 hello 間隔為 10 秒。dead 間隔是路由器在宣告某鄰居路由器失效前,等待該鄰居訊息的時間(秒)。預設情況下,dead 間隔是 hello 間隔的四倍。這些計時器在相鄰路由器之間必須相同,否則無法建立鄰接關係。
  • Neighbors: The Neighbors field lists the adjacent routers from which the router has received a hello packet. Bidirectional communication occurs when the router recognizes itself in the Neighbors field of the hello packet from the neighbor.鄰居:「鄰居」欄位列出路由器已收到其 hello 封包的相鄰路由器。當路由器在鄰居所傳來的 hello 封包的「鄰居」欄位中辨識出自己時,就會發生雙向通訊。
  • Area ID: To communicate, two routers must share a common segment and their interfaces must belong to the same OSPF area on this segment. The neighbors must also be on the same subnet (with the same subnet mask). These routers in the same area will all have the same LSDB information for that area.區域 ID:要進行通訊,兩台路由器必須共用一個共同的區段,且它們在此區段上的介面必須屬於相同的 OSPF 區域。這些鄰居也必須位於同一個子網路(具有相同的子網路遮罩)。位於同一區域的這些路由器,對該區域都會有相同的 LSDB 資訊。
  • Router priority: The router priority is an 8-bit number. OSPF uses the priority to select a designated router (DR) and backup designated router (BDR). In certain types of networks, OSPF elects DRs and BDRs. The DR acts as a central exchange point to reduce traffic between routers.路由器優先權:路由器優先權是一個 8 位元的數字。OSPF 使用優先權來選出指定路由器(DR)與備援指定路由器(BDR)。在某些類型的網路中,OSPF 會選出 DR 與 BDR。DR 作為中央交換點,以減少路由器之間的流量。
  • DR and BDR IPv4 addresses: These addresses are the IPv4 addresses of the DR and BDR for the specific network, if they are known.DR 與 BDR IPv4 位址:這些位址是特定網路上 DR 與 BDR 的 IPv4 位址(若已知的話)。
  • Authentication data:If router authentication is enabled, two routers must exchange the same authentication data. Authentication is not required, but if it is enabled, all peer routers must have the same key configured.驗證資料:若啟用路由器驗證,兩台路由器必須交換相同的驗證資料。驗證不是必要的,但若啟用,所有對等路由器都必須設定相同的金鑰。
  • Stub area flag:A stub area is a special area. Designating a stub area is a technique that reduces routing updates by replacing them with a default route. Two routers have to agree on the stub area flag in the hello packets to become neighbors.末端區域旗標:末端區域(stub area)是一種特殊區域。指定末端區域是一種以預設路由取代路由更新,藉此減少路由更新的技術。兩台路由器必須在 hello 封包中就末端區域旗標達成一致,才能成為鄰居。
  • Media type: Nowadays, the majority of connections between neighboring routers are based on ethernet. To achieve a faster routing performance, it makes sense to convert the media types of both neighbors from the default value "broadcast" to "point-to-point".媒介類型:現今,相鄰路由器之間的大多數連線都是以乙太網路為基礎。為了達到更快的路由效能,將雙方鄰居的媒介類型從預設值「broadcast」轉換為「point-to-point」是合理的做法。

OSPF routers establish a neighbor relationship over point-to-point links.

OSPF 路由器透過點對點鏈路建立鄰居關係。

  • Commonly a serial interface running either PPP or High-Level Data Link Control (HDLC)通常是執行 PPP 或高階資料鏈結控制(HDLC)的序列介面
  • May also be a point-to-point subinterface running Frame Relay or ATM也可能是執行訊框中繼(Frame Relay)或 ATM 的點對點子介面
  • Does not require DR or BDR election不需要選出 DR 或 BDR
  • May be optionally configured on Ethernet links for directly connected routers as a non-default media type: point-to-point. In this case, it should be configured on both ends of the link (both router interfaces as point-to-point)可選擇性地在直接連接路由器的乙太網路鏈路上,設定為非預設媒介類型:point-to-point。在此情況下,應在鏈路兩端(兩台路由器介面都設為 point-to-point)進行設定

A point-to-point network joins a single pair of routers. A serial line that is configured with a data link layer protocol such as PPP or HDLC is an example of a point-to-point network. On these types of networks, the router dynamically detects its neighboring routers by multicasting its hello packets to all OSPF routers, using the 224.0.0.5 address. On point-to-point networks, neighboring routers become adjacent whenever they can communicate directly. No DR or BDR election is performed; there can be only two routers on a point-to-point link, so there is no need for a DR or BDR. The default OSPF hello and dead timers on point-to-point links are 10 seconds and 40 seconds, respectively.

點對點網路連接單一對路由器。以 PPP 或 HDLC 等資料鏈結層協定設定的序列線路,就是點對點網路的一個範例。在這類網路上,路由器會透過使用 224.0.0.5 位址向所有 OSPF 路由器群播其 hello 封包,動態偵測其相鄰路由器。在點對點網路上,相鄰路由器只要能直接通訊就會成為鄰接關係。不會執行 DR 或 BDR 選舉,因為一條點對點鏈路上只能有兩台路由器,因此不需要 DR 或 BDR。點對點鏈路上預設的 OSPF hello 與 dead 計時器分別為 10 秒與 40 秒。

Which OSPF hello packet information must be different for the OSPF neighbor relationship to be formed between the two routers?為了讓兩台路由器之間形成 OSPF 鄰居關係,哪一項 OSPF hello 封包資訊必須不同?