Verify: Keepalived IP Failover Working Or Not With tcpdump Command

by on July 1, 2010 · 3 comments· LAST UPDATED July 1, 2010

in

I've installed keepalived IP failover software as described here. But how do I verify it is working or not?

By default keepalived uses 224.0.0.18 IP address for VRRP (Virtual Router Redundancy Protocol) for communication between two nodes for health check. All you have to do is run tcpdump as follows on eth0 (or eth1) to make sure communication is established:
tcpdump -v -i eth0 host 224.0.0.18
tcpdump -vvv -n -i eth0 host 224.0.0.18

Sample outputs:

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
16:54:01.743275 IP (tos 0x0, ttl 255, id 451, offset 0, flags [none], proto: VRRP (112), length: 96) 10.10.28.5 > 224.0.0.18: VRRPv2, Advertisement, vrid 51, prio 103, authtype simple, intvl 1s, length 76, addrs(15): 123.12.15.2,123.12.15.3[|vrrp]
16:54:02.744241 IP (tos 0x0, ttl 255, id 452, offset 0, flags [none], proto: VRRP (112), length: 96) 10.10.28.5 > 224.0.0.18: VRRPv2, Advertisement, vrid 51, prio 103, authtype simple, intvl 1s, length 76, addrs(15): 123.12.15.2,123.12.15.3[|vrrp]

Where,

  • 10.10.28.5 - your eth0 ip.
  • 123.12.15.2 and 123.12.15.3 - Virtual IPs manage by keepalived.
  • 224.0.0.18 - multicast request.

If you do not see any communication, than make sure keepalived service started on both nodes:
# service keepalived status
# service keepalived start

Make sure firewall is configured to accept accept multicast and vrrp protocol (IP Protocol # 112):
# /sbin/iptables -I INPUT -i eth0 -d 224.0.0.0/8 -j ACCEPT
# /sbin/iptables -A INPUT -p 112 -i eth0 -j ACCEPT
# /sbin/iptables -A OUTPUT -p 112 -o eth0 -j ACCEPT
# /sbin/service iptables save

Adjust above rules as per your interface and other requirements.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 3 comments… read them below or add one }

1 Tapas Mallick July 4, 2010 at 2:33 pm

instead of “# /sbin/iptables -I INPUT -i eth0 -d 224.0.0.0/8 -j ACCEPT”, I believe It should be “# /sbin/iptables -I INPUT -i eth0 -s 224.0.0.0/8 -j ACCEPT”, Please validate once and confirm.

Reply

2 eric November 9, 2010 at 8:59 am

no, just /sbin/iptables -I INPUT -i eth0 -d 224.0.0.0/8 -j ACCEPT!

Reply

3 Stefan May 2, 2012 at 6:57 am

Thanks a lot. It was very helpful!

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: