Interview Prep/Networking/Sockets, ports, TIME_WAIT and conntrack

keepalived moves a VIP to the backup node, but HAProxy on that node fails to start with `cannot bind socket [10.0.1.100:443]`.

IntermediateTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer

Likely causes → HAProxy starts before the VIP is assigned to the node (it's on the master), and Linux refuses to bind to an address that isn't local (EADDRNOTAVAIL).

Diagnose →

ip addr show | grep 10.0.1.100
sysctl net.ipv4.ip_nonlocal_bind
journalctl -u haproxy | grep -i bind

Fix → Allow binding to non-local addresses so HAProxy runs on both nodes all the time:

echo 'net.ipv4.ip_nonlocal_bind = 1' | sudo tee /etc/sysctl.d/90-vip.conf
sudo sysctl --system && sudo systemctl restart haproxy

Alternatively bind to *:443 and filter by destination in ACLs.

Prevent → Test failover regularly; with ip_nonlocal_bind both proxies are warm and failover is only an ARP update.

All Networking questions Roadmap: Networking for DevOps

More on Sockets, ports, TIME_WAIT and conntrack