<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://kb.linux-vs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Redgtux</id>
		<title>LVSKB - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://kb.linux-vs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Redgtux"/>
		<link rel="alternate" type="text/html" href="http://kb.linux-vs.org/wiki/Special:Contributions/Redgtux"/>
		<updated>2026-04-28T15:17:42Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://kb.linux-vs.org/wiki?title=Building_Two-Node_Directors/Real_Servers_using_LVS_and_Keepalived&amp;diff=3996</id>
		<title>Building Two-Node Directors/Real Servers using LVS and Keepalived</title>
		<link rel="alternate" type="text/html" href="http://kb.linux-vs.org/wiki?title=Building_Two-Node_Directors/Real_Servers_using_LVS_and_Keepalived&amp;diff=3996"/>
				<updated>2007-04-27T14:40:08Z</updated>
		
		<summary type="html">&lt;p&gt;Redgtux: /* Instructions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
This guide is a brief explanation on getting a two node director/[[real server]] setup going using [[LVS]] and [[keepalived]].&lt;br /&gt;
&lt;br /&gt;
This is an adaptation of the information at [http://www.ultramonkey.org/2.0.1/topologies/sl-ha-lb-eg.html Ultra Monkey: Streamline High Availablility and Load Balancing] to work with [[keepalived]].&lt;br /&gt;
&lt;br /&gt;
It is primarily targeted at RHEL3/4 (RedHat Enterprise Linux).&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
Setup a two node [[LVS]] cluster with Apache as the virtualised services, with both nodes operating as both directors and [[real server]]s.&amp;lt;br&amp;gt;&lt;br /&gt;
Setup healthchecking of services (httpd).&amp;lt;br&amp;gt;&lt;br /&gt;
Setup lvs-syncing of connections (ipvsadm sync daemon).&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Knowledge Required ==&lt;br /&gt;
&lt;br /&gt;
Understanding of Layer 3 [[load balancing]].&amp;lt;br&amp;gt;&lt;br /&gt;
Understanding of Linux LVS.&amp;lt;br&amp;gt;&lt;br /&gt;
Understanding of Apache configuration.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Components Required ==&lt;br /&gt;
&lt;br /&gt;
Base installation of RHEL3/4.&amp;lt;br&amp;gt;&lt;br /&gt;
RPM Packages for httpd.&amp;lt;br&amp;gt;&lt;br /&gt;
RPM Packages for [[keepalived]].&amp;lt;br&amp;gt;&lt;br /&gt;
RPM Packages for [[ipvsadm]].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Instructions ==&lt;br /&gt;
Install keepalived and IPVSADM on both servers.&lt;br /&gt;
&lt;br /&gt;
On the first server create the file /etc/keepalived/keepalived.conf :&lt;br /&gt;
&lt;br /&gt;
 global_defs {&lt;br /&gt;
   router_id DEV &lt;br /&gt;
 }&lt;br /&gt;
 vrrp_instance VI_1 {&lt;br /&gt;
    state MASTER&lt;br /&gt;
    interface eth0&lt;br /&gt;
    virtual_router_id 51&lt;br /&gt;
    priority 100&lt;br /&gt;
    advert_int 10&lt;br /&gt;
    authentication {&lt;br /&gt;
        auth_type PASS&lt;br /&gt;
        auth_pass 1111&lt;br /&gt;
    }&lt;br /&gt;
    virtual_ipaddress {&lt;br /&gt;
       192.168.6.240&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 virtual_server 192.168.6.240 80 {&lt;br /&gt;
    delay_loop 10&lt;br /&gt;
    lb_algo rr&lt;br /&gt;
    lb_kind DR&lt;br /&gt;
    persistence_timeout 5&lt;br /&gt;
    protocol TCP&lt;br /&gt;
    real_server 192.168.6.4 80 {&lt;br /&gt;
        TCP_CHECK {&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    real_server 192.168.6.5 80 {&lt;br /&gt;
        TCP_CHECK {&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
On the second server create the file /etc/keepalived/keepalived.conf :&lt;br /&gt;
 global_defs {&lt;br /&gt;
   router_id DEV&lt;br /&gt;
 }&lt;br /&gt;
 vrrp_instance VI_1 {&lt;br /&gt;
    state BACKUP&lt;br /&gt;
    interface eth0&lt;br /&gt;
    virtual_router_id 51&lt;br /&gt;
    priority 99&lt;br /&gt;
    advert_int 10&lt;br /&gt;
    authentication {&lt;br /&gt;
        auth_type PASS&lt;br /&gt;
        auth_pass 1111&lt;br /&gt;
    }&lt;br /&gt;
    virtual_ipaddress {&lt;br /&gt;
       192.168.6.240&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 virtual_server 192.168.6.240 80 {&lt;br /&gt;
    delay_loop 10&lt;br /&gt;
    lb_algo rr&lt;br /&gt;
    lb_kind DR&lt;br /&gt;
    persistence_timeout 5&lt;br /&gt;
    protocol TCP&lt;br /&gt;
    real_server 192.168.6.5 80 {&lt;br /&gt;
        TCP_CHECK {&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
On both servers create the file /etc/sysconfig/network-scripts/ifcfg-lo:0&lt;br /&gt;
 DEVICE=lo:0&lt;br /&gt;
 IPADDR=192.168.6.240&lt;br /&gt;
 NETMASK=255.255.255.255&lt;br /&gt;
 ONBOOT=yes&lt;br /&gt;
 NAME=loopback&lt;br /&gt;
&lt;br /&gt;
In order to avoid warning messages, we explicitly say that our gateway is on eth0.&lt;br /&gt;
Add in /etc/sysconfig/network&lt;br /&gt;
 GATEWAYDEV=eth0&lt;br /&gt;
&lt;br /&gt;
Add in /etc/sysctl.conf :&lt;br /&gt;
 net.ipv4.conf.eth0.arp_ignore = 1&lt;br /&gt;
 net.ipv4.conf.eth0.arp_announce = 2&lt;br /&gt;
 # Enables packet forwarding&lt;br /&gt;
 net.ipv4.ip_forward = 1&lt;br /&gt;
&lt;br /&gt;
 ifup lo&lt;br /&gt;
 sysctl -p&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
[[Image:sl-ha-lb-eg.jpg|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{lvs-example-stub}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:LVS Examples|Keepalived]]&lt;/div&gt;</summary>
		<author><name>Redgtux</name></author>	</entry>

	</feed>