Ingress Option 1: Direct DNS Round-Robin (No Front Proxy)
Every backend hermEX pod (Pod 0, Pod 1, Pod N) runs the full proxy-capable stack (gateway, imap, pop3, sieve, mta). When a user or remote SMTP sender connects to any pod, that pod reads users.homeserver and domains.homeserver from MariaDB and proxies traffic transparently to the owning pod. Because of that design, small and medium clusters can expose backend pods directly via DNS Round-Robin without deploying any separate front-end load balancer.
When you need automated millisecond health eviction without waiting on client DNS caching, add Stateless Edge Proxy Nodes or a dedicated L4 TCP Load Balancer in front.
1. Architecture Overview
Internet / Mail Clients / Remote MTAs
DNS returns A = [203.0.113.10, 203.0.113.11, 203.0.113.12]
MX returns priority 10 -> mx0, mx1, mx2
| |
v v
+---------------------+ +---------------------+
| Pod 0 (node_id: 0) | | Pod 1 (node_id: 1) |
| Public 203.0.113.10 | | Public 203.0.113.11 |
| Private 10.0.0.10 | | Private 10.0.0.11 |
+----------+----------+ +----------+----------+
\ /
\ Pod Bridge (10.0.0) /
+--------------------+
| Shared MariaDB VIP |
+--------------------+
2. Complete DNS Record Matrix (2 or 3 Pods)
The example below configures a 2-pod cluster hosting domain example.com:
Pod 0(node_id: 0): public IP203.0.113.10, private IP10.0.0.10Pod 1(node_id: 1): public IP203.0.113.11, private IP10.0.0.11
Publish all records below at your DNS provider (keep TTL low, 60 to 300 seconds, so emergency DNS changes propagate quickly):
Infrastructure & Shared Mail Hostnames
| Type | Name | Value | TTL | Purpose |
|---|---|---|---|---|
A | mx0 | 203.0.113.10 | 300 | Dedicated SMTP hostname for Pod 0 (must match mx0.example.com PTR) |
A | mx1 | 203.0.113.11 | 300 | Dedicated SMTP hostname for Pod 1 (must match mx1.example.com PTR) |
A | mail | 203.0.113.10 | 120 | DNS round-robin target for Webmail, IMAP, POP3, Exchange, DAV |
A | mail | 203.0.113.11 | 120 | DNS round-robin target 2 for mail.example.com |
A | admin | 203.0.113.10 | 300 | Admin Panel endpoint (Pod 0 runs hermex-admin serve) |
CNAME | autodiscover | mail.example.com | 300 | Outlook / Exchange Autodiscover |
CNAME | autoconfig | mail.example.com | 300 | Thunderbird / generic Autoconfig |
CNAME | mta-sts | mail.example.com | 300 | MTA-STS HTTPS policy file host |
If you use Cloudflare DNS, disable proxying (orange cloud off, DNS only) on mx0, mx1, mail, admin, autodiscover, autoconfig, and mta-sts. Cloudflare orange-cloud proxy blocks SMTP (25, 465, 587), IMAP (143, 993), POP3 (110, 995), ManageSieve (4190), and TLS-ALPN-01 ACME verification.
Hosted Mail Domain Records (example.com)
| Type | Name | Value / Target | Priority | Purpose |
|---|---|---|---|---|
MX | @ | mx0.example.com | 10 | Equal-weight inbound SMTP to Pod 0 |
MX | @ | mx1.example.com | 10 | Equal-weight inbound SMTP to Pod 1 (MTAs automatically fail over to the live pod) |
TXT | @ | v=spf1 mx ip4:203.0.113.10 ip4:203.0.113.11 -all | n/a | Authorizes every pod that runs outbound hermex-mta |
TXT | hermex._domainkey | (copy from hermex-admin dns-records example.com) | n/a | DKIM public key (shared across all pods via MariaDB + key_secret) |
TXT | _dmarc | v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com | n/a | DMARC enforcement and aggregate reporting |
TXT | _mta-sts | v=STSv1; id=2026120601 | n/a | MTA-STS version token |
TXT | _smtp._tls | v=TLSRPTv1; rua=https://mail.example.com/tlsrpt | n/a | TLS-RPT reporting destination |
SRV | _imaps._tcp | 0 1 993 mail.example.com | 0 | Implicit-TLS IMAP discovery |
SRV | _submission._tcp | 0 1 587 mail.example.com | 0 | SMTP submission discovery |
SRV | _autodiscover._tcp | 0 1 443 mail.example.com | 0 | Exchange Autodiscover SRV |
SRV | _caldavs._tcp / _carddavs._tcp | 0 1 443 mail.example.com | 0 | CalDAV and CardDAV SSL service discovery |
Reverse DNS (PTR) at Your VPS / Cloud Provider
Configure one PTR record per pod public IP matching its MX / A identity:
203.0.113.10->mx0.example.com(and setPod 0/etc/hermex/config.json"hostname": "mx0.example.com"or"mail.example.com"matching PTR)203.0.113.11->mx1.example.com
Outbound mail from any pod's hermex-mta worker connects using that pod's public IPv4 address. Remote receivers immediately check PTR (rDNS), EHLO banner hostname, and SPF. Missing ip4: entries or missing PTR records on Pod 1 will cause outbound mail from Pod 1 to fail SPF or land in spam.
3. Complete BIND 9 Zone Example
If you self-host authoritative DNS on BIND 9 (named):
$ORIGIN example.com.
$TTL 300
@ IN SOA ns1.example.com. hostmaster.example.com. (
2026120601 ; serial
3600 ; refresh
900 ; retry
1209600 ; expire
300 ) ; minimum
@ IN NS ns1.example.com.
@ IN NS ns2.example.com.
; Per-pod SMTP endpoints and MX targets
mx0 300 IN A 203.0.113.10
mx1 300 IN A 203.0.113.11
@ 300 IN MX 10 mx0.example.com.
@ 300 IN MX 10 mx1.example.com.
; Client protocol round-robin across both pods
mail 120 IN A 203.0.113.10
mail 120 IN A 203.0.113.11
; Admin host pinned to Pod 0 (runs hermex-admin serve)
admin 300 IN A 203.0.113.10
autodiscover 300 IN CNAME mail.example.com.
autoconfig 300 IN CNAME mail.example.com.
mta-sts 300 IN CNAME mail.example.com.
@ 300 IN TXT "v=spf1 mx ip4:203.0.113.10 ip4:203.0.113.11 -all"
_dmarc 300 IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"
_mta-sts 300 IN TXT "v=STSv1; id=2026120601"
_smtp._tls 300 IN TXT "v=TLSRPTv1; rua=https://mail.example.com/tlsrpt"
_imaps._tcp 300 IN SRV 0 1 993 mail.example.com.
_submission._tcp 300 IN SRV 0 1 587 mail.example.com.
_autodiscover._tcp 300 IN SRV 0 1 443 mail.example.com.
_caldavs._tcp 300 IN SRV 0 1 443 mail.example.com.
_carddavs._tcp 300 IN SRV 0 1 443 mail.example.com.
4. Shared ACME Certificates Across Pods
When Pod 0 or Pod 1 renews Let's Encrypt TLS certificates for mail.example.com or customer domains via TLS-ALPN-01 (443) or HTTP-01 (80), hermEX encrypts the issued certificate and private key using key_secret and stores it in MariaDB. Both pods poll the database every 15 seconds, so clients hitting either 203.0.113.10 or 203.0.113.11 receive the exact same valid certificate without manual file copying.
5. Verification
Confirm DNS round-robin returns both pod IPs and that TLS, IMAP, and SMTP answer cleanly on each IP independently:
# Confirm multiple A and MX records resolve
dig +short A mail.example.com
dig +short MX example.com
# Test HTTPS gateway TLS certificate on each pod directly
for ip in 203.0.113.10 203.0.113.11; do
echo "=== Pod $ip ==="
curl -sk --resolve mail.example.com:443:"$ip" https://mail.example.com/api/v1/branding
openssl s_client -connect "$ip":993 -servername mail.example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -dates
done
# Run hermEX built-in DNS diagnostics (also checks multiple A/MX/SPF records)
sudo hermex-admin -config /etc/hermex/config.json check-dns example.com
When to Upgrade From DNS Round-Robin to a Load Balancer
DNS Round-Robin works smoothly for SMTP (remote MTAs automatically try the other MX record) and for modern webmail browsers implementing Happy Eyeballs (RFC 8305). However, if one pod stops abruptly for maintenance or hardware failure, legacy desktop IMAP/POP3/ActiveSync clients that cache one IP from A mail.example.com can stall until their DNS TTL expires. When zero-stall pod failover is required, deploy Ingress Option 3: L4 TCP Load Balancer.