These are te two steps to set up load balancer wit NAT.
examplelets say LVS routers’ public interfaces (eth0) will be on the 192.168.2/24 network (This is not a routable IP, but assume there is a firewall in front of the LVS router) and the private interfaces which link to the real servers (eth1) will be on the 10.1.12/24 network.
Note that editing of the following files pertain to the network service and the Load Balancer is not compatible with the NetworkManager service.on the active or node of primary LVS router, the public interface’s script for network, /etc/sysconfig/network-scripts/ifcfg-eth0, could look like this;=0
=192.168.25.254on /etc/sysconfig/network-scripts/ifcfg-eth1 for the private NAT interface as on the LVS router could look like this:
from te example, the VIP for the LVS router’s public interface will be 192.168.25.10 and the VIP for the NAT/private interface will be 10.1.12.10. we can see that it is essential for the real servers route requests back to the VIP for the NAT interface.
The sample Ethernet interface configuration settings in this section are for the real IP addresses of an LVS router and not the floating IP addresses.wen configuring the primary LVS router node’s network interfaces, we have to configure the backup LVS router’s real network interfaces — ensuring that none of the IP address conflict with any other IP addresses on the network.
Be sure each interface on the backup node services the same network as the interface on primary node. Lets say if eth0 connects to the public network on the primary node, it must also connect to the public network on the backup node as well.
wen configuring the real servers network interfaces in a NAT topology the most important ting to keep in mind is to set gateway for NAT floating address of LVS router
we use address 10.1.12.10
Once the network interfaces are up on the real servers, no machines will be able to ping or connect in in any oter ways to the public network.pin will only be possible to te real IP for te LVS routers private interface,te IP is 10.1.12.9
the real server’s /etc/sysconfig/network-scripts/ifcfg-eth0 file is most likely be similar to this:=0
wen a real server has more than one network interface configured with a GATEWAY= line, always te first one to come up will get the gateway.in a case were bot eth0 and eth1 are confiured and eth1 is bein used as Load Balancer,in suc a case realservers may not be in a position to route requests properlyIt is advicable to turn off te extra network interfaces by setting ONBOOT=no in their network scripts within the /etc/sysconfig/network-scripts/ directory or by ensurin the gateway is correctly set in the interface tat comes up first.
3. Enabling NAT Routing on the LVS Routers
a simple NAT Load Balancer configuration in which each clustered service uses only one port an example port;80,te administrator is required of him only to enable packet forwarding on te LVS routers so tat te request will be properly routed between te outside world servers and real servers,
but more configuration is necessary when the clustered services needs more tan one port to same real servers during a user session.wen forwarding is enabled on te LVS router and real servers are set up havin clustered services running, we use keepalived to configure IP information
avoid configur the floating IP for eth0 or eth1 by manually editing network scripts or using a network configuration tool,but configure them via keepalived.conf file.When te process is completed, start the keepalived service and Once it is up and running, the active LVS router will begin routing requests to the pool of real servers.