1.8.3. 路​​​​​​​由​​​​​​​方​​​​​​​法​​​​​​​

您​​​​​​​可​​​​​​​以​​​​​​​在​​​​​​​ LVS 里​​​​​​​使​​​​​​​用​​​​​​​网​​​​​​​络​​​​​​​地​​​​​​​址​​​​​​​转​​​​​​​换​​​​​​​(Network Address Translation,NAT)或​​​​​​​直​​​​​​​接​​​​​​​路​​​​​​​由​​​​​​​。​​​​​​​下​​​​​​​面​​​​​​​的​​​​​​​内​​​​​​​容​​​​​​​简​​​​​​​单​​​​​​​地​​​​​​​描​​​​​​​述​​​​​​​了​​​​​​​在​​​​​​​ LVS 里​​​​​​​使​​​​​​​用​​​​​​​ NAT 路​​​​​​​由​​​​​​​和​​​​​​​直​​​​​​​接​​​​​​​路​​​​​​​由​​​​​​​。​​​​​​​

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.
LVS Implemented with NAT Routing

图 1.22. LVS Implemented with NAT Routing

在​​​​​​​这​​​​​​​个​​​​​​​例​​​​​​​子​​​​​​​中​​​​​​​,活​​​​​​​跃​​​​​​​ LVS 路​​​​​​​由​​​​​​​器​​​​​​​装​​​​​​​有​​​​​​​两​​​​​​​块​​​​​​​网​​​​​​​络​​​​​​​接​​​​​​​口​​​​​​​卡​​​​​​​(NIC)。​​​​​​​Internet 使​​​​​​​用​​​​​​​的​​​​​​​ NIC 在​​​​​​​ eth0 上​​​​​​​有​​​​​​​一​​​​​​​个​​​​​​​真​​​​​​​实​​​​​​​的​​​​​​​ IP 地​​​​​​​址​​​​​​​,它​​​​​​​也​​​​​​​有​​​​​​​一​​​​​​​个​​​​​​​别​​​​​​​名​​​​​​​为​​​​​​​ eth0:1 的​​​​​​​浮​​​​​​​动​​​​​​​ IP 地​​​​​​​址​​​​​​​。​​​​​​​专​​​​​​​用​​​​​​​网​​​​​​​络​​​​​​​接​​​​​​​口​​​​​​​的​​​​​​​ NIC 在​​​​​​​ eth1 上​​​​​​​有​​​​​​​一​​​​​​​个​​​​​​​真​​​​​​​实​​​​​​​的​​​​​​​ IP 地​​​​​​​址​​​​​​​以​​​​​​​及​​​​​​​别​​​​​​​名​​​​​​​为​​​​​​​ eth1:1 的​​​​​​​浮​​​​​​​动​​​​​​​ IP 地​​​​​​​址​​​​​​​。​​​​​​​在​​​​​​​故​​​​​​​障​​​​​​​切​​​​​​​换​​​​​​​发​​​​​​​生​​​​​​​时​​​​​​​,面​​​​​​​向​​​​​​​ Internet 的​​​​​​​虚​​​​​​​拟​​​​​​​接​​​​​​​口​​​​​​​以​​​​​​​及​​​​​​​专​​​​​​​用​​​​​​​虚​​​​​​​拟​​​​​​​接​​​​​​​口​​​​​​​由​​​​​​​备​​​​​​​份​​​​​​​ LVS 路​​​​​​​由​​​​​​​器​​​​​​​同​​​​​​​时​​​​​​​接​​​​​​​管​​​​​​​。​​​​​​​专​​​​​​​用​​​​​​​网​​​​​​​络​​​​​​​中​​​​​​​的​​​​​​​所​​​​​​​有​​​​​​​真​​​​​​​实​​​​​​​服​​​​​​​务​​​​​​​器​​​​​​​都​​​​​​​使​​​​​​​用​​​​​​​用​​​​​​​于​​​​​​​ NAT 路​​​​​​​由​​​​​​​器​​​​​​​的​​​​​​​浮​​​​​​​动​​​​​​​ IP 地​​​​​​​址​​​​​​​来​​​​​​​作​​​​​​​为​​​​​​​与​​​​​​​活​​​​​​​跃​​​​​​​ LVS 路​​​​​​​由​​​​​​​器​​​​​​​通​​​​​​​信​​​​​​​的​​​​​​​默​​​​​​​认​​​​​​​路​​​​​​​由​​​​​​​,这​​​​​​​样​​​​​​​它​​​​​​​们​​​​​​​响​​​​​​​应​​​​​​​来​​​​​​​自​​​​​​​ Internet 的​​​​​​​请​​​​​​​求​​​​​​​的​​​​​​​能​​​​​​​力​​​​​​​就​​​​​​​不​​​​​​​会​​​​​​​被​​​​​​​削​​​​​​​弱​​​​​​​。​​​​​​​
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 地​​​​​​​址​​​​​​​,所​​​​​​​以​​​​​​​这​​​​​​​个​​​​​​​过​​​​​​​程​​​​​​​被​​​​​​​称​​​​​​​作​​​​​​​ IP 伪​​​​​​​装​​​​​​​(masquerading)。​​​​​​​
使​​​​​​​用​​​​​​​ NAT 路​​​​​​​由​​​​​​​,真​​​​​​​实​​​​​​​服​​​​​​​务​​​​​​​器​​​​​​​可​​​​​​​以​​​​​​​是​​​​​​​运​​​​​​​行​​​​​​​不​​​​​​​同​​​​​​​操​​​​​​​作​​​​​​​系​​​​​​​统​​​​​​​的​​​​​​​任​​​​​​​何​​​​​​​类​​​​​​​型​​​​​​​的​​​​​​​机​​​​​​​器​​​​​​​。​​​​​​​NAT 的​​​​​​​主​​​​​​​要​​​​​​​缺​​​​​​​点​​​​​​​是​​​​​​​ LVS 路​​​​​​​由​​​​​​​器​​​​​​​可​​​​​​​能​​​​​​​成​​​​​​​为​​​​​​​大​​​​​​​型​​​​​​​部​​​​​​​署​​​​​​​中​​​​​​​的​​​​​​​瓶​​​​​​​颈​​​​​​​,因​​​​​​​为​​​​​​​它​​​​​​​既​​​​​​​得​​​​​​​处​​​​​​​理​​​​​​​转​​​​​​​入​​​​​​​又​​​​​​​得​​​​​​​处​​​​​​​理​​​​​​​转​​​​​​​出​​​​​​​的​​​​​​​请​​​​​​​求​​​​​​​。​​​​​​​

为了尽快向用户提供最新的信息,本文档可能会包括由机器自动从英文原文翻译的内容。如需更多信息,请参阅此说明。