Keepalived is a Linux daemon that provides failover and load balancing for IP addresses. You can use the tcpdump
command to verify that Keepalived is working properly and to diagnose any issues with the failover or load balancing.
To verify Keepalived IP failover with tcpdump
, you can follow these steps:
tcpdump
command to capture the traffic on the virtual IP address that is being managed by Keepalived. For example:tcpdump -n -i <interface> host <virtual-ip>
This will capture the traffic on the specified <interface>
that is destined for the <virtual-ip>
address. The -n
option disables name resolution, and the -i
option specifies the interface to capture.
On the passive Keepalived server, run the same tcpdump
command to capture the traffic on the virtual IP address.
On the client system, send traffic to the virtual IP address. This can include sending a ping request, connecting to a service, or running any other type of traffic that is expected to reach the virtual IP address.
Observe the output of the tcpdump
command on the active and passive Keepalived servers. If the virtual IP address is working properly, you should see the traffic on the active server and not on the passive server.
If you want to test the failover, you can stop the Keepalived daemon on the active server or simulate a failure of the active server. This should cause the virtual IP address to failover to the passive server.
Observe the output of the tcpdump
command on the active and passive Keepalived servers. If the failover is working properly, you should see the traffic on the passive server and not on the active server.
By using tcpdump
to capture and analyze the traffic on the virtual IP address, you can verify that Keepalived is working properly and troubleshoot any issues with the failover or load balancing.
Keep in mind that tcpdump
is a powerful and flexible tool, and there are many other options and techniques that you can use to capture and analyze the traffic. You may want to refer to the tcpdump
man page or online documentation for more information.