We reviewed "KeepAlived" - IP failover package which has VRRP stack direct IP failover on a Redhat Linux RHEL operating system. Below is a summary and review of this method -
Our test setup
- Server A , Main IP - 192.10.0.173
- Server B , Main IP - 192.10.0.49
- Virtual / floating IPs - 192.10.0.193,192.10.0.194
- Downloaded the latest keepalived package from their website - http://www.keepalived.org/download.html - this comes default with our operating system DVD also as RPMs.
- tar -zxvf keepalived-1.2.12.tar.gz
- cd keepalived-1.2.12
- ./configure
- make
- make install
- Above commands executed in both server A and B as root user.
Configuration files
- /usr/local/etc/keepalived/keepalived.conf
- Priority parameter decides the master server holding
the VIPs based on voting mechanism. Higher the value - greater
the priority. Server A has high priority
- interface parameter decides on which interface the virtual IPs should bind.
- virtual_ipaddress parameter - one or more virtual IPs can be configured.
- More information on each parameter will be present in their man page - doc/man/man5/keepalived.conf.5
Server A configuration - /usr/local/etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id A
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 1
priority 150
garp_master_delay 5
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.10.0.193
192.10.0.194
}
}
Server B configuration - /usr/local/etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id B
}
vrrp_instance VI_1 {
state BACKUP
interface br0
virtual_router_id 1
priority 100
garp_master_delay 5
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.10.0.193
192.10.0.194
}
}
Starting and Stopping the service
- /usr/local/sbin/keepalived -f
/usr/local/etc/keepalived/keepalived.conf -D -d
, where -f is the config file , -D & -d are for debug logs
- All logs are written to /var/log/messages and current status
can be tracked easily using tshark / tcpdump - tcpdump -i
any -R vrrp
- To shutdown , ps -ef |grep keepalive , get the PID and kill it.
- Alternately this can be configured as a service under /etc/init.d and started as service keepalived stop and stopped as service keepalived stop
- Use , ip addr show command to view the VIP port mapping details.
Hope this is useful to some keepalived beginners.