Wednesday 19 August 2015

How to Configure Linux Virtual Server (LVS) in CentOS, RHEL

Linux Virtual Server Project (LVS) allows you to configure load balancing cluster server, specially for networked services like web server and mail server. This allows TCP and UDP sessions to be load balanced between multiple real servers

{NOTE:- Backend webservers are also called real servers, Actually user (or) clients they don't know about backend, frontend servers they will be connect directly to this Service IP Address (or) Service Hostname.
After that LVS server forward the packets to these backend servers.
Service IP Address of LVS :- 192.168.15.254
Internal IP Address of LVS:-  172.66.249.15
These two webservers will be connected to the LVS Server using Internal IP address of LVS }



Below I have mentioned the steps to configure lvs server


LVS server IP and Hostname:- 172.66.249.15 & 192.168.15.254 , lvsnode1.example.com

Backend First Web Server IP and Hostname:- 172.66.249.10, node1.example.com

Backend Second Web Server IP and Hostname:- 172.66.249.11, node2.example.com

First Install the ipvsadm package:-

The sysctl settings { Linux kernel parameters } are stored in /etc/sysctl.conf, and are loaded at each boot.
To enable IPv4 forwarding on your RHEL system, use the following command: vim /etc/sysctl.conf to edit the file and add the following line:

net.ipv4.ip_forward = 1 

sysctl command is used to modify kernel parameters at runtime
so to load setting Please enter command # sysctl -p 

Then after please start the ipvsadm service 




To clear the default LVS setting type ipvsadm -C {C for clear}

Finally save the newly created rules

No comments:

Post a Comment