LVS Load Balancing Cluster Mode -- NAT

LVS Load Balancing Cluster Mode – NAT

Experimental Topology

In this experiment, we aim to implement an address translation mode (LVS-NAT) cluster. The experimental objectives are to create a load balancing cluster using LVS-NAT and to verify its functionality.

Experimental Requirements

  1. Network Deployment: The network topology consists of a client host and four Linux servers. The client host uses a Linux server as its host, while the other four servers are Linux servers. All servers have their firewalls turned off, and the NetworkManager service is stopped. The default gateway for web1 and web2 is set to 192.168.1.12, and the LVS server is configured to forward routing.
  2. SNAT Configuration: The SNAT (Source Network Address Translation) is configured on the LVS server, and the firewall rules are modified accordingly.
  3. Virtual Server IP Address: The IP address of the virtual server cluster is set to 200.0.0.1, and the IP addresses of the server nodes are 192.168.1.2 and 192.168.1.3.
  4. HTTPD Server Configuration: The HTTPD server is configured on web1 and web2, with the website directory set to /var/www/html. The test results show that the web content is not the same on both servers.
  5. NFS Deployment: In a real-world scenario, the two web pages are served from the corresponding NFS server. Therefore, the shared storage NFS service is deployed on the server, and the page is stored in /var/www/html. The two web servers mount the NFS shared directory and configure automatic mounting.
  6. Client Access: The client accesses the cluster using the virtual server IP address 200.0.0.1 to verify that the page can see two web servers and the load balancing functions.

Step-by-Step Configuration

Step 1: Network Configuration

  • The client host uses a Linux server as its host, while the other four servers are Linux servers.
  • All servers have their firewalls turned off, and the NetworkManager service is stopped.
  • The default gateway for web1 and web2 is set to 192.168.1.12.

Step 2: LVS Server Configuration

  • Open the routing forwarding on the LVS server.
  • Configure the SNAT firewall rules.
  • Load the ip_vs module and install the ipvsadm management tools.
  • Create a virtual server and add server nodes.
  • Set the boot policy to start from the beginning.

Step 3: HTTPD Server Configuration

  • Configure the HTTPD server on web1 and web2, with the website directory set to /var/www/html.
  • Test the results show that the web content is not the same on both servers.

Step 4: NFS Deployment

  • Install the NFS server and nfs-utils package rpcbind.
  • Set the boot policy to start from the beginning and set up a shared directory.
  • Add the default page to the shared directory.
  • The shared directory is shared using 192.168.2.0/24.
  • Start the NFS service program.
  • Manually mount the NFS share on the two web servers.
  • Configure automatic mounting using fstab.

Step 5: Client Access

  • The client accesses the cluster using the virtual server IP address 200.0.0.1 to verify that the page can see two web servers and the load balancing functions.

Verification

  • The client accesses the cluster using the virtual server IP address 200.0.0.1 to verify that the page can see two web servers and the load balancing functions.
  • The test results show that the web content is the same on both servers, and the load balancing functions are working correctly.