A service must be reachable on a virtual IP that fails over between two Linux load balancers. How?
AdvancedScenarioNetworking, SSH and remote access
Answer
Situation read → VRRP with keepalived.
What I'd do →
/etc/keepalived/keepalived.conf on the primary:
vrrp_script chk_haproxy {
script "/usr/bin/systemctl is-active --quiet haproxy"
interval 2
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication { auth_type PASS auth_pass s3cr3t }
virtual_ipaddress { 10.0.1.100/24 }
track_script { chk_haproxy }
}
Backup node: state BACKUP, priority 100. Allow VRRP (protocol 112) in the firewall.
Why → If HAProxy dies, the priority drops and the VIP moves; neighbours learn the new MAC via gratuitous ARP.
Interview tip → In most clouds VRRP multicast doesn't work, so use the cloud LB or an API-driven failover.
More on Networking, SSH and remote access
A key belonging to a departed engineer may be in `authorized_keys` on 300 servers. How do you rotate SSH keys across the fleet?IntermediateYou need to reach a database on a private subnet from your laptop through a bastion. How?BeginnerYour security team wants SSH hardened on all servers. What changes do you make?BeginnerA new server needs a static IP, gateway and DNS on RHEL 9. How do you configure it persistently?BeginnerYou're changing the network config of a remote server over SSH and could lose access. How do you protect yourself?IntermediateA web server should accept HTTP/HTTPS from anywhere but SSH only from the office. Configure the firewall.Beginner