31 · Exploring Layer 3 Redundancy探索第 3 層備援

Understanding FHRP認識 FHRP

Since most IP hosts have a single default gateway IP address, which does not change when the network topology changes, an extra feature on routers is needed that can provide Layer 3 gateway redundancy to the hosts. First Hop Redundancy Protocols (FHRPs) are a group of protocols with similar functionality that enable a set of routers or Layer 3 switches to present an illusion of a "virtual" router. The virtual router is assigned a virtual IP address and virtual MAC address, which is shared by two routers. This is the base prerequisite to achieve gateway redundancy to hosts that cannot detect a change in the network.

由於大多數 IP 主機只有單一預設閘道 IP 位址,且該位址不會隨網路拓樸變化而改變,因此路由器需要額外的功能,才能為主機提供第 3 層閘道備援。第一跳備援協定(FHRP)是一組功能類似的協定,可讓一組路由器或第 3 層交換器共同呈現出一個「虛擬」路由器的假象。這個虛擬路由器會被指派一個虛擬 IP 位址與虛擬 MAC 位址,並由兩台路由器共用。這是要讓無法偵測網路變化的主機也能享有閘道備援的基本前提。

The following figure represents a generic FHRP scenario with a set of routers working together to present the illusion of a single router to the hosts on the LAN. By sharing an IP (Layer 3) address and a MAC (Layer 2) address, two or more routers can act as a single "virtual" router.

下圖呈現了一個常見的 FHRP 情境:一組路由器共同運作,向區域網路(LAN)上的主機呈現單一路由器的假象。透過共用一個 IP(第 3 層)位址與 MAC(第 2 層)位址,兩台以上的路由器可以扮演成單一個「虛擬」路由器。

Hosts that are on the local subnet should have the IP address of the virtual router as their default gateway. When an IPv4 host needs to communicate to another IPv4 host on a different subnet, it will use Address Resolution Protocol (ARP) to resolve the MAC address of the default gateway. The ARP resolution returns the MAC address of the virtual router. The host then encapsulates the packets inside frames sent to the MAC address of the virtual router; these packets are then routed to their destination by any active router that is part of that virtual router group. The standby router takes over if the active router fails. Therefore, the virtual router as a concept has an active (forwarding) router and standby router.

本地子網路上的主機應將虛擬路由器的 IP 位址設為其預設閘道。當 IPv4 主機需要與不同子網路上的另一台 IPv4 主機通訊時,會使用位址解析協定(ARP)來解析預設閘道的 MAC 位址。ARP 解析會傳回虛擬路由器的 MAC 位址。主機接著會將封包封裝在框架中,並傳送到虛擬路由器的 MAC 位址;這些封包接著會由虛擬路由器群組中任一台作用中的路由器路由至目的地。若作用中路由器失效,待命路由器便會接手。因此,虛擬路由器這個概念包含一台作用中(轉送)路由器與一台待命路由器。

You use an FHRP to coordinate two or more routers as the devices that are responsible for processing the packets that are sent to the virtual router. The host devices send traffic to the address of the virtual router. The actual (physical) router that forwards this traffic is transparent to the end stations.

FHRP 用來協調兩台以上的路由器,讓它們共同負責處理傳送到虛擬路由器的封包。主機裝置會將流量傳送到虛擬路由器的位址,而實際負責轉送流量的(實體)路由器對終端站台而言是透明的。

The redundancy protocol provides the mechanism for determining which router should take the active role in forwarding traffic and determining when a standby router should take over that role. When the forwarding router fails, the standby router detects the change and a failover occurs. Hence, the standby router becomes active and starts forwarding traffic destined for the shared IP address and MAC address. The transition from one forwarding router to another is transparent to the end devices.

備援協定提供一種機制,用來決定哪一台路由器應擔任轉送流量的作用中角色,以及何時待命路由器該接手該角色。當轉送路由器失效時,待命路由器會偵測到變化並進行容錯移轉。此時,待命路由器會轉為作用中並開始轉送傳送到共用 IP 位址與 MAC 位址的流量。從一台轉送路由器切換到另一台的過程,對終端裝置而言是透明的。

A common feature of FHRP is to provide a default gateway failover that is transparent to hosts. Cisco routers and switches typically support the use of three FHRPs:

FHRP 的共同特色是提供對主機透明的預設閘道容錯移轉功能。Cisco 路由器與交換器通常支援以下三種 FHRP:

  1. Hot Standby Router Protocol (HSRP): HSRP is an FHRP that Cisco designed to create a redundancy framework between network routers or Layer 3 switches to achieve default gateway failover capabilities. Only one router per subnet forwards traffic. HSRP is defined in RFC 2281.熱備援路由器協定(Hot Standby Router Protocol,HSRP):HSRP 是 Cisco 設計的 FHRP,可在網路路由器或第 3 層交換器之間建立備援架構,以達成預設閘道容錯移轉能力。每個子網路只有一台路由器負責轉送流量。HSRP 定義於 RFC 2281。
  2. Virtual Router Redundancy Protocol (VRRP): VRRP is an open FHRP standard that offers the ability to add more than two routers for additional redundancy. Only one router per subnet forwards traffic. VRRP is defined in RFC 5798.虛擬路由器備援協定(Virtual Router Redundancy Protocol,VRRP):VRRP 是一種開放式 FHRP 標準,可支援兩台以上的路由器以提供額外備援。每個子網路只有一台路由器負責轉送流量。VRRP 定義於 RFC 5798。
  3. Gateway Load Balancing Protocol (GLBP): GLBP is an FHRP that Cisco designed to allow multiple active forwarders to load-balance outgoing traffic on a per host basis rather than a per subnet basis like HSRP.閘道負載平衡協定(Gateway Load Balancing Protocol,GLBP):GLBP 是 Cisco 設計的 FHRP,可讓多台作用中的轉送者以每台主機(而非像 HSRP 那樣以每個子網路)為單位,對外送流量進行負載平衡。

The routers communicate FHRP information between each other through hello messages, which also represent a keepalive mechanism. This figure illustrates the FHRP failover process.

路由器之間會透過 hello 訊息交換 FHRP 資訊,這也是一種保持連線機制。下圖說明了 FHRP 的容錯移轉流程。

When the forwarding router or the link, where FHRP is configured, fails, these steps take place:

當轉送路由器或設定了 FHRP 的鏈路失效時,會發生以下步驟:

  1. The standby router stops seeing hello messages from the forwarding router.待命路由器不再收到轉送路由器的 hello 訊息。
  2. The standby router assumes the role of the forwarding router.待命路由器接手成為轉送路由器。
  3. Because the new forwarding router assumes both the IP and MAC addresses of the virtual router, the end stations see no disruption in service.由於新的轉送路由器同時取得虛擬路由器的 IP 位址與 MAC 位址,終端站台不會感受到任何服務中斷。
Interactive content from the online course (not available offline)線上課程的互動內容(離線版未收錄)
Which three protocols are examples of FHRP? (Choose three.)以下哪三種協定屬於 FHRP?(選擇三項。)
What is HSRP?什麼是 HSRP?