Introduction
As a sysadmin or DevOps engineer, you have likely experienced the nightmare of a single production server crashing unexpectedly in the middle of the night. Whether caused by faulty RAM, disk I/O bottlenecks, or a kernel panic, the outcome is the same. Even if your monitoring stack alerts you on Telegram within 5 seconds, it still takes at least 15 to 30 minutes to open your laptop, SSH into the machine, diagnose the issue, or update DNS records. For an e-commerce platform or internal API, that 30-minute blackout translates to thousands of failed requests and urgent escalation calls from management.
Fedora Server is an excellent Linux distribution for lab and staging environments thanks to its up-to-date kernel and packages. Below is a step-by-step guide to building a 2-node HA cluster on Fedora Server 39/40. The architecture uses a single Virtual IP (VIP) as the unified entry point for incoming traffic. If the primary (Active) node fails, the standby node automatically assumes control of the VIP in just 1 to 2 seconds, ensuring an uninterrupted experience for end users.
Core Concepts
A Linux HA cluster revolves around five fundamental building blocks:
- Corosync: Handles cluster messaging and membership. It periodically broadcasts heartbeat packets (default: 1000ms) over UDP port 5405 to monitor node health. It also tracks Quorum (the minimum number of active votes required) to prevent split-brain scenarios.
- Pacemaker: The Cluster Resource Manager (CRM). When Corosync detects a node failure, Pacemaker decides whether to restart failed services or migrate the Virtual IP to a healthy node.
- PCS (Pacemaker/Corosync Configuration System): A unified CLI and daemon (
pcsd) for synchronizing configurations across the entire cluster. You can manage everything from a single terminal rather than editing raw XML files manually. - Virtual IP (Floating IP): An abstract IP address exposed to clients that dynamically migrates between physical nodes.
- STONITH (Shoot The Other Node In The Head): A hardware-level fencing mechanism (via iDRAC, iLO, or IPMI) that isolates unresponsive nodes. STONITH is mandatory in production. However, in this 2-node lab guide, we will temporarily disable STONITH to focus on IP failover mechanics.
Step-by-Step Implementation
Prepare two clean Fedora Server virtual machines residing in the same local subnet:
- Node 1: Hostname
fedora-node01, IP192.168.122.10 - Node 2: Hostname
fedora-node02, IP192.168.122.11 - Virtual IP (VIP):
192.168.122.100(must be unallocated within the /24 LAN subnet)
Step 1: Configure Hostnames, Hosts File, and Firewall
Both nodes must resolve each other directly without relying on external DNS. Set their hostnames and update the local hosts file:
# On Node 1
sudo hostnamectl set-hostname fedora-node01
# On Node 2
sudo hostnamectl set-hostname fedora-node02
# Add to /etc/hosts on BOTH NODES:
sudo tee -a /etc/hosts <<EOF
192.168.122.10 fedora-node01
192.168.122.11 fedora-node02
EOF
Open required firewall ports for Pacemaker, PCS, and Corosync traffic via firewalld:
sudo firewall-cmd --permanent --add-service=high-availability
sudo firewall-cmd --reload
Step 2: Install Packages and Set the hacluster Password
Install the cluster stack directly from standard Fedora repositories:
# Run on BOTH NODES:
sudo dnf install -y pcs pacemaker corosync fence-agents-all
sudo systemctl enable --now pcsd
The installation automatically provisions the hacluster system account. Assign an identical password to this account on both machines:
sudo passwd hacluster
Step 3: Authenticate and Initialize the Cluster
From this point onward, you only need to run commands from the terminal on fedora-node01.
First, authenticate cluster communications between both hosts using the hacluster credentials:
sudo pcs host auth fedora-node01 fedora-node02 -u hacluster
Once the status reports Authorized, create and bootstrap a cluster named my_web_cluster:
sudo pcs cluster setup my_web_cluster fedora-node01 fedora-node02
sudo pcs cluster start --all
sudo pcs cluster enable --all
Verify initial cluster status:
sudo pcs status
If both nodes report an Online state, the cluster is synchronized and active.
Step 4: Adjust Settings for a 2-Node Topology
By default, a 2-node cluster stalls when one node fails because quorum is lost (active vote ratio drops below 50% + 1). Additionally, Pacemaker enforces STONITH out of the box, which is unavailable in standard lab VMs without IPMI. Run these two commands to configure the cluster for a 2-node lab setup:
# Disable STONITH requirement (Note: For lab environments only)
sudo pcs property set stonith-enabled=false
# Allow the cluster to manage resources even when quorum is lost
sudo pcs property set no-quorum-policy=ignore
Step 5: Create the Virtual IP Resource
Use the ocf:heartbeat:IPaddr2 Resource Agent to manage VIP 192.168.122.100. Replace eth0 with your actual network interface name (run ip -br link to check):
sudo pcs resource create Cluster_VIP ocf:heartbeat:IPaddr2 \
ip=192.168.122.100 \
cidr_netmask=24 \
nic=eth0 \
op monitor interval=10s
Verify that the resource is running:
sudo pcs status resources
The terminal will output: Cluster_VIP (ocf::heartbeat:IPaddr2): Started fedora-node01. Running ip a show eth0 on fedora-node01 will confirm that the secondary IP 192.168.122.100/24 is active.
Step 6: Test Automatic Failover
From a separate client workstation on the same LAN, open a terminal and run continuous ICMP pings to the VIP:
ping 192.168.122.100
Return to the cluster terminal and place fedora-node01 into standby mode to simulate a node outage:
sudo pcs node standby fedora-node01
Watch the ping stream: you should drop at most a single packet (~1 second of interruption). Pacemaker on Node 2 immediately executes the IPaddr2 script, binds the VIP to its own interface, and broadcasts Gratuitous ARP (GARP) frames to update the ARP tables on network switches.
Check the resource status again:
sudo pcs status resources
The output now confirms: Cluster_VIP (ocf::heartbeat:IPaddr2): Started fedora-node02.
Once maintenance is complete, restore Node 1 to active service:
sudo pcs node unstandby fedora-node01
By default, the VIP stays on fedora-node02. Pacemaker avoids automatic failback to prevent unnecessary resource flapping.
Conclusion
With just a handful of pcs commands, you have deployed a fully functional 2-node HA cluster on Fedora Server. The Virtual IP acts as a resilient gateway, delivering 1- to 2-second failover times and keeping downtime to an absolute minimum.
As a next step, you can bundle Nginx, HAProxy, or database services into a unified Resource Group co-located with the VIP. Remember, when transitioning to production, always deploy hardware fencing (IPMI/iDRAC) and re-enable STONITH to protect distributed data against split-brain corruption.

