Load balancing Metaswitch vEAS SSS with a bare-metal loxilb pair

A drop-in replacement for the Loadbalancer.org deployment: same VIPs, persistence and health checks, built on an eBPF load balancer with keepalived failover and connection sync. An nginx + ModSecurity WAF tier is optional.

2 nodesactive / standby
9 VIPssample pools.txt
~8 sdead-server removal
v0.9.8.8loxilb release
Download the bundle (.tar.gz)
Clients reach SERV VIPs on the active loxilb node; management hosts reach MGMT VIPs; both load balance to the EAS servers; keepalived and connection sync link the two nodes. External clientsCommPortal, Accession, IMAP Management hoststrusted CIDRs only (ACL) loxilb A · MASTER VIPs on lo + gARPgateway VIP (VRRP)eBPF NAT · TCP probes loxilb B · BACKUP VIPs withdrawntakes over in ~3 ssynced connection table VRRPCT sync SERV VIP · L4 NAT MGMT VIP · fullnat EAS SSS 1gw = SERV_GW_VIP EAS SSS 2gw = SERV_GW_VIP source-IP persistence

Overview

Two bare-metal Linux servers run loxilb, an eBPF load balancer, in front of the Metaswitch EAS SSS servers. One node is active at a time. keepalived decides which, holds the EAS default-gateway IP on the service network, and tells loxilb to bring its VIPs up (MASTER) or withdraw them (BACKUP). loxilb syncs its connection table to the peer, so established sessions survive a failover.

All services are declared in one file, pools.conf, which mirrors the EAS pools.txt. A script turns it into loxilb rules through the REST API every time loxilb starts, and removes rules that have been deleted from the file.

Everything here is in the bundle: install script, apply/validate tools, keepalived hooks and the optional WAF. Use the download button above or the file browser.

How the Loadbalancer.org guide maps to loxilb

Loadbalancer.org guideThis deployment
Layer 7 SNAT VIP, TCP mode (management network)loxilb fullnat: the EAS sees the VIP as the source, like L7 SNAT
Layer 4 NAT VIP (service network)loxilb default DNAT: the client IP reaches the EAS
Weighted round robin, equal weightsRound robin
Source-IP persistence, sticky value from pools.txtpersist selection when STICKY > 0, round robin when 0
Health check: connect to port, interval 3, 2 failuresTCP connect probe, period 3 s, 2 retries
Client / server timeouts 900 / 901 s900 s idle timeout on fullnat VIPs
Floating IP as the EAS default gatewaykeepalived VRRP SERV_GW_VIP
HA pair with persistence-table replicationloxilb --cluster/--self connection sync
Management VIPs reachable from trusted networks onlyPer-rule allowed source CIDRs (ACL_mgmt)
TLS passed through, certificates on the EASSame: loxilb is layer 4 and never decrypts

Prerequisites

  • Two x86_64 servers with Ubuntu 22.04/24.04 or Debian 12, kernel 5.15 or newer. Sizing from the original guide: at least 8 cores and 16 GB RAM for up to 250,000 subscribers.
  • One NIC or VLAN per network: management (eth0 in the examples) and service (eth1), with a fixed IP on each per node. A dedicated link for connection sync is better but not required.
  • Out-of-band console (IPMI, iDRAC, iLO). loxilb attaches eBPF programs to every interface, and a mistake can cut SSH.
  • The EAS pools.txt from /home/defcraft/files on an EAS server: VIPs, ports, sticky values and real servers.
  • Outbound HTTPS from the nodes to GitHub (loxilb .deb) and the distro mirrors during install.

Address plan worksheet

Fill this in before touching the servers. The values are the samples from the guide and the bundle's config files.

ItemSampleSet in
Node A / B service IP192.168.85.240 / .241node.env VRRP_SELF_IP, VRRP_PEER_IP
Node A / B management IPyour choicehost networking
Peer IP for connection sync10.225.37.229node.env PEER_SYNC_IP
Service gateway VIP (EAS default gw)192.168.85.1/18eas-lb.conf SERV_GW_VIP
MGMT VIPs10.225.37.227, .223, .224pools.conf
SERV VIP192.168.85.150pools.conf
EAS management IPs10.225.37.231, .116pools.conf
EAS service IPs192.168.85.61, .5pools.conf
Trusted management CIDRs10.225.0.0/16eas-lb.conf ACL_mgmt
VRRP router ID / password51 / 8 chars maxeas-lb.conf
SERV VIP routing. External clients must be able to reach the SERV VIP. Either put it on a subnet the loxilb nodes are attached to (loxilb sends gratuitous ARP from the active node) or have your edge router route it to the nodes.

Install the pair

1

Copy the bundle to both nodes

scp loxilb-eas.tar.gz admin@lb-a:/tmp/ && scp loxilb-eas.tar.gz admin@lb-b:/tmp/
ssh admin@lb-a 'cd /tmp && tar xzf loxilb-eas.tar.gz'
2

Describe the services in pools.conf

One line per VIP:port. Copy the VIPs, ports, sticky values and servers from pools.txt. MODE is fullnat for management VIPs and nat for service VIPs. PORT can be VIPPORT:RSPORT for port translation.

# NAME               MODE     VIP             PORT   STICKY  ACL   REALS
MGMT_HTTPS-443       fullnat  10.225.37.227   443    2100    mgmt  10.225.37.231,10.225.37.116
MGMT_IMAP-143        fullnat  10.225.37.223   143    0       mgmt  10.225.37.231,10.225.37.116
MGMT_MVWEBPROV-8087  fullnat  10.225.37.224   8087   86400   mgmt  10.225.37.231,10.225.37.116
SERV_HTTPS-443       nat      192.168.85.150  443    2100    any   192.168.85.61,192.168.85.5
SERV_IMAP-143        nat      192.168.85.150  143    0       any   192.168.85.61,192.168.85.5

Single internal network (the guide's Scenario 2): keep only the fullnat lines and skip the EAS gateway change.

3

Set shared and per-node settings

config/eas-lb.conf is identical on both nodes: interfaces, gateway VIP, ACLs, probe timers. node.env differs per node.

cp config/node.env.example /tmp/node.env
# node A                        # node B
NODE_ID=0                       NODE_ID=1
PEER_SYNC_IP=<B sync IP>        PEER_SYNC_IP=<A sync IP>
VRRP_SELF_IP=192.168.85.240     VRRP_SELF_IP=192.168.85.241
VRRP_PEER_IP=192.168.85.241     VRRP_PEER_IP=192.168.85.240
VRRP_PRIORITY=150               VRRP_PRIORITY=100
4

Run the installer on each node

sudo ./scripts/00-install-node.sh /tmp/node.env

It installs curl, jq, keepalived and loxilb 0.9.8.8 (.deb, systemd), enables IP forwarding, runs loxilb as a two-node cluster, renders /etc/keepalived/keepalived.conf, and installs eas-lb-rules.service, which applies pools.conf whenever loxilb starts. Configs live in /etc/eas-lb/. Re-running the installer keeps your edited copies.

5

Preview and apply rules

sudo eas-lb-apply --dry-run   # print the JSON sent to loxilb
sudo eas-lb-apply             # apply, remove stale rules, save to /etc/loxilb

Changes on the EAS servers

  • Default gateway on the service interface → SERV_GW_VIP. Without it, replies to L4 NAT traffic bypass loxilb and connections fail. Check in EAS Craft: Configuration → Network parameters → Manage subnets → List all subnets.
  • DNS: point the CommPortal, Accession and IMAP host names at the VIPs.
  • Certificates stay where they are. See TLS certificates.
  • Internet access from the EAS: the guide's Auto-NAT isn't replicated, so send EAS outbound traffic through your firewall.

Verify

eas-lb-validate          # on each node: VRRP role, loxilb HA state, rules, endpoint health
./scripts/20-validate.sh --client   # from a client: TCP connect to every VIP:port

Expected on the active node: keepalived MASTER, loxicmd get hastate MASTER, VIPs on lo, gateway VIP on the service interface, every endpoint active. The standby shows BACKUP with no VIPs on lo.

Functional tests (adapted from the guide)

TestHowPass when
Health checksStop EAS services on one server in EAS CraftIts endpoints go inactive in loxicmd get ep within ~8 s, traffic continues on the other
PersistenceLog in to CommPortal through a sticky VIPThe session stays on the same EAS while it is up
FailoverPower off the active node mid-sessionPeer becomes MASTER in ~3 s and synced sessions carry on
ACLConnect to a MGMT VIP from an untrusted hostConnection refused or dropped
Metaswitch tooltestpools.py from a non-EAS hostAll pools pass

How failover works

  1. keepalived runs one VRRP instance on the service network (unicast, router ID 51), tracking both interfaces and a check script that polls the loxilb API every 2 s.
  2. On a state change, the notify hook records the role and posts it to loxilb (POST /netlox/v1/config/cistate). MASTER puts every VIP on lo and sends gratuitous ARP; BACKUP removes them.
  3. If loxilb restarts it comes back without a role. The check script re-asserts the current one within ~2 s. Repeating an unchanged state is a no-op in loxilb.
  4. If the loxilb API stops answering, the check fails twice and keepalived drops to FAULT, handing MASTER to the peer.
  5. nopreempt is set: a recovered primary doesn't take the role back on its own. To move it, restart keepalived on the current MASTER in a quiet window.

TLS certificates

With loxilb alone, the certificates stay on the EAS servers. loxilb forwards the encrypted stream on 443 and 10000 untouched, just as the guide's TCP-mode VIPs do, so TLS runs end to end between client and EAS.

  • The EAS certificate must cover the names clients use. They now resolve to the VIPs, so put the external and management names in its SAN list.
  • Install the same certificate on every EAS in a pool, or users see warnings depending on where persistence sends them.
  • Health checks are plain TCP connects and need no certificate.
  • With the optional WAF, a copy of the CommPortal certificate and key also goes on the WAF nodes, because they decrypt to inspect.

Day-to-day operations

TaskCommand
Add, change or remove a poolEdit /etc/eas-lb/pools.conf on both nodes, then sudo eas-lb-apply
See rules / endpoint healthloxicmd get lb -o wide · loxicmd get ep
See HA roleloxicmd get hastate · cat /run/eas-lb/vrrp.state
Planned failoversudo systemctl restart keepalived on the MASTER
Take a node outsudo systemctl stop keepalived (peer takes over), then work on it
Logsjournalctl -u loxilb -u keepalived -u eas-lb-rules · journalctl -t eas-lb
Upgrade loxilbStandby first: set LOXILB_VERSION, re-run the installer, fail over, repeat on the other node

Troubleshooting

SymptomLikely causeCheck / fix
SERV VIP accepts SYN but no replyEAS default gateway isn't SERV_GW_VIPFix the EAS subnet gateway; check with tcpdump -ni eth1 host <EAS>
VIPs on both nodes or neitherVRRP can't reach the peer, or loxilb has no rolejournalctl -u keepalived; check unicast IPs and the auth password; loxicmd get hastate
Endpoints all inactiveProbe blocked or wrong portnc -vz <EAS> <port> from the node; port translation needs VIP:RS in PORT
eas-lb-apply: API not reachableloxilb not runningsystemctl status loxilb; journalctl -u loxilb
Rule rejected (HTTP 4xx)Malformed line, unknown ACL nameRun with --dry-run; define ACL_<name> in eas-lb.conf
Management VIP unreachable from an admin hostSource not in ACL_mgmtAdd the CIDR and re-apply

Known differences from the guide

  1. Persistence timeout is fixed at 3 hours. loxilb 0.9.8.8 has a per-rule persistence timeout internally but neither the REST API nor loxicmd exposes it. The 2100 s pools stay sticky longer than 35 minutes (harmless); MVWEBPROV-8087 gets 3 hours instead of 24.
  2. Health-check timing is approximate. loxilb's checker ticks every 2 s, so a 3 s period behaves like ~4 s.
  3. fullnat isn't a proxy. No X-Forwarded-For on management VIPs. The guide's L7 SNAT hides client IPs as well.
  4. No Auto-NAT. Route EAS outbound traffic through your firewall.
  5. Lab first. The REST payloads were checked against the loxilb 0.9.8.8 source, not run against a live loxilb. The WAF was tested end to end.

Optional WAF tier

Two small Ubuntu 24.04 hosts run nginx + ModSecurity v3 + OWASP CRS between the SERV VIP and the EAS for ports 80 and 443. loxilb sends those ports to the WAF nodes (L4, so the WAF sees real client IPs). The WAF terminates TLS, inspects, and re-encrypts to the EAS with client-IP affinity.

#ProtectionDefault
1Per-IP login rate (nginx)10/min, burst 10 → 429
2Per-IP lockout (ModSecurity)>30 attempts in 5 min → 15 min block
3Per-account cap (ModSecurity)>10 attempts per number in 10 min
4Common-password spraying (ModSecurity)≥3 in 10 min → 30 min block
5Global login flood cap (nginx)50/s, burst 100
cp waf/waf.env.example /tmp/waf.env   # cert paths, EAS servers, login field names
sudo ./waf/install-waf.sh /tmp/waf.env
# then on both loxilb nodes: WAF_ENABLE=1 and WAF_NODES in /etc/eas-lb/eas-lb.conf
sudo eas-lb-apply
Before enabling: confirm CommPortal's login path and field names in browser dev tools (defaults are /login, DirectoryNumber, Password), set the WAF nodes' default gateway to SERV_GW_VIP, and start in DetectionOnly. Ubuntu's libmodsecurity keeps counters per nginx worker; use worker_processes 1; for exact counts.

Files

Every file in the bundle. Pick one to read, copy or download it.