Skip to main content
STALWART JMAPRELAY FOUNDRY // JMAP + IMAP + SMTP RUST MAIL SIZING STUDIO ROCKSDB + TANTIVY FTS | VULTR PORT 25 PTR | INTERSERVER STORAGE SLICE | 2026-10-29
StalwartMailVPS
StalwartMailVPS Affiliate Notice: Outbound /go/ links marked rel="sponsored" may earn a partner commission at zero added cost (Affiliate Policy).
Mail Server Presets

Docker Host-Network vs Bridge Mode for Real SMTP Client IPs

Preserve authentic external SMTP sender IPs for SPF, RBL, and fail2ban checks by running Stalwart with host networking or HAProxy PROXY protocol.

Zero Docker NAT Spoofing · Real IPv4/IPv6 · SPF Accurate

Docker Host-Network vs Bridge Mode for Real SMTP Client IPs
Mail engineering baseline verified 2026-10-29 by JMAPRelay Foundry.

The Docker Bridge NAT Trap on Mail Servers

Running a mail server behind standard Docker userland proxy NAT rewrites incoming IPv4 and IPv6 source addresses to the internal bridge gateway. Every inbound spammer then appears to come from 172.18.0.1, bypassing DNSBLs and distorting SPF checks.

Fixing Source IPs With Host Networking or Native Binary

Set network_mode: host in Docker Compose or install Stalwart directly as a systemd service under a dedicated unprivileged stalwart-mail user with ambient CAP_NET_BIND_SERVICE.

Measured Thresholds & Stalwart Configuration Parameters

Container Network ModeInbound Client IP VisibilitySPF / RBL Impact
Bridge NAT (Default Docker)Sees 172.17.0.1 gateway IPBreaks SPF, DNSBL, and rate limiting completely
network_mode: hostSees genuine external IPv4/IPv6Recommended single-node setup for Vultr & InterServer
PROXY Protocol v2Preserves IP behind load balancerRequired only when fronted by external TCP proxy
Systemd Binary InstallDirect host sockets (no Docker)Lowest overhead; binds ports 25, 465, 993, 443 cleanly
Zero Docker NAT Spoofing · Real IPv4/IPv6 · SPF Accurate Deploy Vultr NVMeInterServer Slice