Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Run HAProxy on two Linux servers and use Keepalived’s VRRP implementation to move one reserved virtual IP address (VIP) between them. Clients always connect to the VIP; if the active load balancer fails its health check, the standby claims the address and begins serving the same HAProxy configuration.

This design is active-passive: only one node owns the VIP at a time. It requires identical HAProxy configurations, a shared Layer 2 network (or an explicitly supported routed VRRP design), and firewall rules that allow the nodes to exchange VRRP advertisements. The examples below use Debian/Ubuntu or RHEL-compatible systems, interface eth0, VIP 192.168.1.100/24, and two backend web servers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the HAProxy–Keepalived design does

HAProxy terminates client connections on the VIP and distributes requests to backend servers. Keepalived does not proxy application traffic; it manages ownership of the VIP with VRRP. The node with the higher priority becomes MASTER, while the other remains BACKUP and monitors the MASTER’s advertisements and health state.

Component Example value Purpose
Primary load balancer lb1, 192.168.1.101 Starts as MASTER with priority 101
Standby load balancer lb2, 192.168.1.102 Starts as BACKUP with priority 100
Floating address 192.168.1.100/24 Client-facing VIP owned by one node at a time
Backend web1 10.0.0.11:8080 Health-checked HAProxy backend
Backend web2 10.0.0.12:8080 Health-checked HAProxy backend

Both load balancers should use the same frontend, backend, timeout, and health-check settings. Only the Keepalived identity and priority differ. Reserve the VIP so that no host, DHCP lease, or other service can use it.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

Requirements and design decisions

  • Two Linux servers on the same subnet, or a network design that explicitly supports VRRP between the interfaces.
  • HAProxy and Keepalived installed on both servers.
  • A VIP that is unused before Keepalived starts and is reachable by clients on the intended subnet.
  • Permission to change kernel sysctl settings and manage systemd services.
  • Network policy permitting VRRP advertisements between the two nodes. VRRP uses IP protocol 112; verify the exact rule syntax for your firewall or cloud network.
  • The backend health URL used by HAProxy must return a success response only when the application is ready to serve traffic.

Keepalived and HAProxy releases are not pinned in this procedure. Distribution packages can differ in accepted options, defaults, service users, and validation flags, so check the man pages installed with your packages before applying a configuration to production.

Prepare both Linux servers

Allow HAProxy to bind the VIP before it is local

Because the standby normally does not own the VIP, Linux would ordinarily reject HAProxy’s bind attempt there. Enable non-local binding on both nodes:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
printf 'net.ipv4.ip_nonlocal_bind=1n' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
sysctl net.ipv4.ip_nonlocal_bind

The final command should report net.ipv4.ip_nonlocal_bind = 1. If your operating system uses a separate file under /etc/sysctl.d/, place the setting there and load that file with the system’s normal sysctl mechanism.

Install the packages

On Debian or Ubuntu:

sudo apt update
sudo apt install haproxy keepalived

On RHEL-compatible distributions such as Rocky or Alma:

sudo dnf install haproxy keepalived

Install the same package family and, where practical, the same versions on lb1 and lb2. Check the service names after installation; the examples assume systemd units named haproxy and keepalived.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Configure identical HAProxy instances

Edit /etc/haproxy/haproxy.cfg on both servers. The following minimal configuration binds directly to the VIP and checks an HTTP health endpoint on each backend:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
frontend fe_web
    bind 192.168.1.100:80
    default_backend be_web

backend be_web
    balance roundrobin
    option httpchk GET /health
    server web1 10.0.0.11:8080 check
    server web2 10.0.0.12:8080 check

Adapt the HAProxy template safely

  • Replace the VIP, port, backend addresses, and health path with values from your network and application.
  • Make sure the application actually exposes /health (or your chosen path) and returns a failure status while it is unhealthy. A URL that always returns success defeats the check.
  • Keep this file byte-for-byte equivalent on lb1 and lb2 unless a deliberate, documented difference is required.
  • Confirm that the operating-system interface carrying the VIP is the one used by Keepalived. HAProxy’s bind address and Keepalived’s VIP must refer to the same network.

Start HAProxy on each node after the configuration is in place:

sudo systemctl enable --now haproxy

If the service does not start, inspect its systemd status and logs before moving on. A syntax error, unavailable backend address, or a bind failure caused by an incorrect VIP or sysctl setting must be fixed on both nodes.

Configure Keepalived on the primary node

On lb1, create /etc/keepalived/keepalived.conf with the following values. The sample uses eth0; substitute the actual interface name shown by your operating system. The authentication value is an example shared secret; generate and protect a stronger secret for production, then use exactly the same value on lb2.

global_defs {
    router_id LB_PRIMARY
    enable_script_security
}

vrrp_script chk_haproxy {
    script "/usr/bin/systemctl is-active --quiet haproxy"
    interval 2
    fall 2
    rise 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 8uQ4mN7p
    }
    virtual_ipaddress {
        192.168.1.100/24 dev eth0
    }
    track_script {
        chk_haproxy
    }
}

What each Keepalived block controls

  • router_id identifies the local instance in logs and must be different on the two servers.
  • vrrp_script runs the HAProxy service check every two seconds. fall 2 requires two consecutive failures before the failure state is acted on; rise 2 requires two successful checks before recovery is accepted.
  • virtual_router_id 51 identifies the VRRP group. It must match on both nodes and must not collide with another VRRP group on the same network.
  • priority 101 is higher than the standby’s priority, so lb1 is preferred when both nodes are healthy.
  • advert_int 1 sends advertisements at a one-second interval in this example.
  • virtual_ipaddress declares the address Keepalived adds to the active interface.
  • track_script connects the service check to the VRRP instance. Without this association, Keepalived would monitor peer advertisements but would not know that a local HAProxy failure should affect ownership.

Configure the standby node

On lb2, use the same file structure, VIP, virtual router ID, authentication type, password, script, and timing values. Change the router ID, state, and priority:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
global_defs {
    router_id LB_SECONDARY
    enable_script_security
}

vrrp_script chk_haproxy {
    script "/usr/bin/systemctl is-active --quiet haproxy"
    interval 2
    fall 2
    rise 2
}

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 8uQ4mN7p
    }
    virtual_ipaddress {
        192.168.1.100/24 dev eth0
    }
    track_script {
        chk_haproxy
    }
}

Do not change virtual_router_id, the shared authentication value, or the VIP between the nodes. A mismatch prevents the two daemons from behaving as one VRRP group. The standby’s lower priority is intentional; it allows lb1 to be preferred when both are available.

Validate and start Keepalived

Validate the configuration on each server before enabling the service:

sudo keepalived --config-test -f /etc/keepalived/keepalived.conf

The exact validation flag has varied between Keepalived releases. If your installed binary rejects --config-test, consult keepalived --help and that release’s man page for the equivalent check-only option. Do not skip validation merely because the file resembles a known example.

Start Keepalived on both nodes:

sudo systemctl enable --now keepalived

Start lb1 first if you want a predictable initial MASTER, then start lb2. On the primary, confirm the VIP is present:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ip addr show eth0

At steady state, lb1 should show 192.168.1.100/24 and lb2 should not. Keepalived service logs are the authoritative place to see state transitions, authentication failures, script results, and interface errors.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

How failover is decided

Keepalived exchanges VRRP advertisements and evaluates the local script. The script’s interval defaults to one second when not specified; this example explicitly uses two seconds. rise and fall prevent a single transient result from immediately changing state.

The MASTER starts with priority 101 and the BACKUP with 100. A health-check failure must reduce the effective preference of the local instance or put it into a fault state so that the healthy peer can claim the VIP. Keepalived versions and documentation differ on the default script weight and on how an instance-level weight overrides a script weight. The current man page for your installed version is the authority; do not assume an older article’s default weight applies to your package.

The sample uses a process check, systemctl is-active --quiet haproxy. That catches a stopped service but can miss a process that is running yet unable to accept or route requests. For a stronger production check, use a Keepalived script that performs an authenticated or otherwise protected local HTTP request through HAProxy and exits nonzero when the response is unusable. Test any custom script separately, keep its path and permissions compatible with enable_script_security, and verify its behavior during a real failure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Perform a controlled failover test

  1. Send test traffic to 192.168.1.100 and verify that HAProxy reaches the expected backend servers.
  2. On lb1, stop only HAProxy: sudo systemctl stop haproxy.
  3. Watch both Keepalived logs and inspect ip addr show eth0 on each node. The VIP should leave lb1 and appear on lb2 after the configured detection and election steps, normally within a few seconds but without a guaranteed downtime figure.
  4. Confirm that new requests sent to the VIP are handled by lb2 and that backend health checks still pass.
  5. Restart HAProxy on lb1: sudo systemctl start haproxy. Observe whether your installed Keepalived version preempts the standby immediately or leaves lb2 active until a policy change. Do not assume failback behavior; options such as nopreempt and their interactions are version-specific.
  6. Repeat the exercise by stopping Keepalived, disconnecting the monitored interface in a maintenance window, and rebooting a node. Each test exercises a different failure path.

Record the observed transition time, log messages, client errors, and backend behavior. A successful VIP move alone does not prove that application sessions, TLS state, long-lived connections, or backend data remain uninterrupted.

Common failure modes and fixes

Symptom Likely cause Checks and corrective action
HAProxy fails to start on the standby Linux rejects a bind to the non-local VIP Verify sysctl net.ipv4.ip_nonlocal_bind returns 1, confirm the VIP is spelled identically, and restart HAProxy after loading sysctl settings.
Neither node owns the VIP Keepalived syntax, interface, or service failure Run the release-appropriate config test, check systemctl status keepalived, inspect logs, and verify that eth0 is the real interface.
Both nodes claim the VIP Split brain caused by blocked or partitioned VRRP traffic Check firewall and network policy for VRRP protocol 112, confirm both servers can see each other’s advertisements, and consider a dedicated heartbeat network or unicast peers where the network requires it.
VIP never moves after HAProxy stops The check is not tracked, the script cannot execute, or failure handling is not configured as expected Confirm track_script names the declared script, run the script manually as the Keepalived service user, review rise/fall timing, and consult the installed man page for script-weight and fault semantics.
Nodes refuse to join the same VRRP group Different virtual router ID, authentication value, interface, or network segment Compare those fields character by character and verify that the VIP subnet and interface are valid on both hosts.
Traffic reaches the VIP but returns errors Backend health endpoint, application listener, or HAProxy configuration problem Test each backend address and health path directly, confirm the service listens on port 8080, and ensure both HAProxy files contain the same backend definitions.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reducing split-brain risk

Split brain is the most dangerous failure mode because two independent nodes can believe they are MASTER and answer for the same address. A simple network partition, an incorrect security-group rule, or a firewall that drops VRRP advertisements can create it.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
  • Permit VRRP traffic only between the two intended nodes and monitor drops or asymmetric routing.
  • Where multicast VRRP is unavailable or unreliable, use the unicast-peer configuration supported by your Keepalived version and a dedicated heartbeat path. Verify the exact syntax before deployment.
  • Keep the VRRP authentication value private and identical on both nodes. Authentication is not a substitute for network isolation.
  • Use monitoring that alerts when both hosts report ownership of the VIP or when neither host owns it.
  • Document a manual recovery procedure: isolate one node from the client network before assigning the VIP manually, then correct the underlying partition.

Operational practices after deployment

Prevent configuration drift

Store HAProxy and Keepalived files in your configuration-management system, deploy changes to the standby first, validate them, and then perform a controlled role switch before changing the former primary. Keep the two HAProxy configurations identical unless a difference is intentional and tested.

Protect service scripts and credentials

Limit write access to /etc/keepalived/keepalived.conf and any health-check scripts. The enable_script_security setting is designed to make unsafe script execution fail rather than silently run an altered command. Replace the sample authentication value, avoid putting secrets in world-readable scripts, and review the service account and file ownership created by your distribution package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan maintenance around ownership

Before patching the current MASTER, verify that the BACKUP is healthy and that a failover has been tested. Drain or stop application traffic according to your connection-handling requirements, move ownership deliberately, patch one node, and verify it before touching the other. Because preemption and failback policies vary by Keepalived release, record the behavior observed on your exact versions and make it part of the runbook.

Limits of this pattern

Keepalived protects the load-balancer endpoint, not the backend applications or their data. A VIP can move successfully while every backend is unhealthy, while existing TCP sessions are reset, or while an upstream network remains unreachable. HAProxy’s backend checks and your application’s readiness endpoint therefore matter as much as VRRP state.

This active-passive arrangement also provides only two load-balancer nodes. It does not by itself provide geographic redundancy, database replication, automatic capacity scaling, or a quorum mechanism for larger clusters. Evaluate those requirements separately before treating VIP failover as a complete disaster-recovery plan.

Configuration checklist

  • VIP is reserved, unused, and on the intended subnet.
  • net.ipv4.ip_nonlocal_bind=1 is loaded on both hosts.
  • HAProxy files are identical and the health URL represents real application readiness.
  • Keepalived uses the correct interface, matching virtual router ID, matching authentication, and the same VIP on both nodes.
  • lb1 has priority 101 and starts as MASTER; lb2 has priority 100 and starts as BACKUP.
  • The HAProxy health script is declared and referenced under track_script.
  • VRRP traffic is allowed between the nodes, and split-brain alerts are in place.
  • A controlled stop-and-restart test has demonstrated VIP movement and service recovery.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.