Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
1.8.3. 路由法則
您可以使用 NAT(網路位址轉換,Network Address Translation)路由,或藉由 LVS 直接進行路由。以下章節會簡短描述 NAT 路由與使用 LVS 來路由。
1.8.3.1. NAT 路由
圖形 1.22, “LVS Implemented with NAT Routing”, illustrates LVS using NAT routing to move requests between the Internet and a private network.

圖形 1.22. LVS Implemented with NAT Routing
在這個例子裡,啟用中的 LVS 路由器有兩張網路卡。連上網際網路的網路卡有位於
eth0
上的實際的 IP 位址,同時有浮動 IP 位址,連到 eth0:1
上。私有網路的網路卡在 eth1
上有實際的 IP 位址,也有浮動的 IP 位址連到 eth1:1
上。在備援情況發生時,網際網路與私有網路的虛擬介面會由備用 LVS 路由器所接手。所以私有網路上的實體伺服器會使用 NAT 路由器的浮動 IP 做為預設路徑,與啟用中的 LVS 路由器溝通,這樣實體伺服器回應網際網路上來的需求,就不會有問題。
In the example, the LVS router's public LVS floating IP address and private NAT floating IP address are aliased to two physical NICs. While it is possible to associate each floating IP address to its physical device on the LVS router nodes, having more than two NICs is not a requirement.
藉由這種拓樸,啟用中的 LVS 路由器會收到需求,並導向到正確的伺服器上。實體伺服器會處理這些需求,然後傳回給 LVS 路由器。LVS 路由器會使用網路位址轉譯,把封包裡面實體伺服器的位址替代成 LVS 路由器的公開 VIP 位址。這個過程稱為 IP masquerading(IP 偽冒),因為實體伺服器的位址被隱藏起來,用戶端是看不見的。
使用 NAT 路由時,實體伺服器可以是執行多種作業系統的任何電腦。NAT 路由的主要缺點是 LVS 路由器可能會成為大型建置環境中的瓶頸,因為它必須處理進、出的需求。