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.
How the Loadbalancer.org guide maps to loxilb
| Loadbalancer.org guide | This 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 weights | Round robin |
Source-IP persistence, sticky value from pools.txt | persist selection when STICKY > 0, round robin when 0 |
| Health check: connect to port, interval 3, 2 failures | TCP connect probe, period 3 s, 2 retries |
| Client / server timeouts 900 / 901 s | 900 s idle timeout on fullnat VIPs |
| Floating IP as the EAS default gateway | keepalived VRRP SERV_GW_VIP |
| HA pair with persistence-table replication | loxilb --cluster/--self connection sync |
| Management VIPs reachable from trusted networks only | Per-rule allowed source CIDRs (ACL_mgmt) |
| TLS passed through, certificates on the EAS | Same: 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 (
eth0in 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.txtfrom/home/defcraft/fileson 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.
| Item | Sample | Set in |
|---|---|---|
| Node A / B service IP | 192.168.85.240 / .241 | node.env VRRP_SELF_IP, VRRP_PEER_IP |
| Node A / B management IP | your choice | host networking |
| Peer IP for connection sync | 10.225.37.229 | node.env PEER_SYNC_IP |
| Service gateway VIP (EAS default gw) | 192.168.85.1/18 | eas-lb.conf SERV_GW_VIP |
| MGMT VIPs | 10.225.37.227, .223, .224 | pools.conf |
| SERV VIP | 192.168.85.150 | pools.conf |
| EAS management IPs | 10.225.37.231, .116 | pools.conf |
| EAS service IPs | 192.168.85.61, .5 | pools.conf |
| Trusted management CIDRs | 10.225.0.0/16 | eas-lb.conf ACL_mgmt |
| VRRP router ID / password | 51 / 8 chars max | eas-lb.conf |
Install the pair
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'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.
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=100Run 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.
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/loxilbChanges 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)
| Test | How | Pass when |
|---|---|---|
| Health checks | Stop EAS services on one server in EAS Craft | Its endpoints go inactive in loxicmd get ep within ~8 s, traffic continues on the other |
| Persistence | Log in to CommPortal through a sticky VIP | The session stays on the same EAS while it is up |
| Failover | Power off the active node mid-session | Peer becomes MASTER in ~3 s and synced sessions carry on |
| ACL | Connect to a MGMT VIP from an untrusted host | Connection refused or dropped |
| Metaswitch tool | testpools.py from a non-EAS host | All pools pass |
How failover works
- 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.
- On a state change, the notify hook records the role and posts it to loxilb (
POST /netlox/v1/config/cistate). MASTER puts every VIP onloand sends gratuitous ARP; BACKUP removes them. - 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.
- If the loxilb API stops answering, the check fails twice and keepalived drops to FAULT, handing MASTER to the peer.
nopreemptis 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
| Task | Command |
|---|---|
| Add, change or remove a pool | Edit /etc/eas-lb/pools.conf on both nodes, then sudo eas-lb-apply |
| See rules / endpoint health | loxicmd get lb -o wide · loxicmd get ep |
| See HA role | loxicmd get hastate · cat /run/eas-lb/vrrp.state |
| Planned failover | sudo systemctl restart keepalived on the MASTER |
| Take a node out | sudo systemctl stop keepalived (peer takes over), then work on it |
| Logs | journalctl -u loxilb -u keepalived -u eas-lb-rules · journalctl -t eas-lb |
| Upgrade loxilb | Standby first: set LOXILB_VERSION, re-run the installer, fail over, repeat on the other node |
Troubleshooting
| Symptom | Likely cause | Check / fix |
|---|---|---|
| SERV VIP accepts SYN but no reply | EAS default gateway isn't SERV_GW_VIP | Fix the EAS subnet gateway; check with tcpdump -ni eth1 host <EAS> |
| VIPs on both nodes or neither | VRRP can't reach the peer, or loxilb has no role | journalctl -u keepalived; check unicast IPs and the auth password; loxicmd get hastate |
| Endpoints all inactive | Probe blocked or wrong port | nc -vz <EAS> <port> from the node; port translation needs VIP:RS in PORT |
eas-lb-apply: API not reachable | loxilb not running | systemctl status loxilb; journalctl -u loxilb |
| Rule rejected (HTTP 4xx) | Malformed line, unknown ACL name | Run with --dry-run; define ACL_<name> in eas-lb.conf |
| Management VIP unreachable from an admin host | Source not in ACL_mgmt | Add the CIDR and re-apply |
Known differences from the guide
- 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
loxicmdexposes it. The 2100 s pools stay sticky longer than 35 minutes (harmless); MVWEBPROV-8087 gets 3 hours instead of 24. - Health-check timing is approximate. loxilb's checker ticks every 2 s, so a 3 s period behaves like ~4 s.
- fullnat isn't a proxy. No X-Forwarded-For on management VIPs. The guide's L7 SNAT hides client IPs as well.
- No Auto-NAT. Route EAS outbound traffic through your firewall.
- 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.
| # | Protection | Default |
|---|---|---|
| 1 | Per-IP login rate (nginx) | 10/min, burst 10 → 429 |
| 2 | Per-IP lockout (ModSecurity) | >30 attempts in 5 min → 15 min block |
| 3 | Per-account cap (ModSecurity) | >10 attempts per number in 10 min |
| 4 | Common-password spraying (ModSecurity) | ≥3 in 10 min → 30 min block |
| 5 | Global 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
/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.