Since I didn't want to buy any new expensive IPv4 addresses, or might not be able to get any at some point, I did configure...
Regardless of the strange /etc/network/interfaces file, which I simply cleaned up manually without knowing where these entries came from.
I implemented the following. In the meantime, I often changed, deleted, or added network settings with interfaces to ultimately arrive at the following configuration. This is the working status:
System Description – Edge Proxy with IPv4/IPv6 and WireGuard Egress
- Architecture Overview
The setup consists of a dual-stack edge server (“Edge Proxy”) and multiple IPv6-only backend systems reachable through it.
An internal WireGuard network provides IPv4 egress capability for IPv6-only clients via the Edge Proxy.
Roles:
- Edge Proxy: Public reverse proxy, IPv4/IPv6 gateway, WireGuard server, NAT endpoint.
- Clients: IPv6-only backend using a WireGuard client for IPv4 egress through the Edge Proxy.
- Additional Backends: IPv6-only systems with direct SSH access via their global IPv6 addresses.
- Network and DNS Design
- The Edge Proxy has public IPv4 and IPv6 addresses.
- Backends (e.g., Clients) have global IPv6 addresses; IPv4 traffic is tunneled through WireGuard.
- Public domain A/AAAA DNS records point to the Edge Proxy.
- Administrative hostnames retain direct AAAA records for IPv6-based SSH access.
- IPv6 routes are native; IPv4 routes from the backends are forwarded via WireGuard through the Edge Proxy.
- Reverse Proxy Layer (TLS Passthrough)
The Edge Proxy runs nginx with the stream module enabled to forward incoming TLS traffic on port 443 based on the SNI hostname to the correct IPv6 backend.
TLS is passed through transparently—no termination occurs at the proxy.
Key characteristics:
- TLS certificates are managed on the backends.
- Routing uses an SNI-to-upstream mapping table.
- Port 80 may optionally be proxied to a single backend handling HTTP→HTTPS redirects.
- Both IPv4 and IPv6 clients connect through the same Edge Proxy endpoint.
- Stream logging includes client address, SNI, upstream target, and connection status.
- WireGuard Egress Network
An internal IPv4 transit network (e.g., 10.10.10.0/24) connects the Edge Proxy and the backends.
- Edge Proxy acts as WireGuard server with 10.10.10.1/24.
- Each backend (e.g., Clients) has a fixed /32 tunnel address (e.g., 10.10.10.2/32).
- The Edge Proxy performs NAT (MASQUERADE) on the public interface for all 10.10.10.0/24 traffic.
- Backends route all outbound IPv4 traffic through the tunnel (AllowedIPs = 0.0.0.0/0).
- IPv6 traffic remains native and is not tunneled.
- UDP/51820 is open on the Edge Proxy for inbound WireGuard connections.
Result:
- IPv6-only backends gain full outbound IPv4 access through the Edge Proxy.
- All backend IPv4 traffic appears externally under the Edge Proxy’s public IPv4 address.
- Operational and Security Aspects
- The Edge Proxy is the only publicly exposed node.
- WireGuard AllowedIPs are tightly limited to one /32 per backend.
- SSH access to backends is IPv6-only.
- Intrusion prevention (e.g., Fail2ban) operates on the Edge Proxy.
- Optional enhancement: enable the PROXY protocol to forward real client IPs to backends.
- Functional Summary
- Incoming HTTP/HTTPS requests reach the Edge Proxy.
- TLS connections are forwarded transparently based on the SNI hostname.
- Backends present their own TLS certificates and handle the requests directly.
- IPv6 communication is native; backend IPv4 communication is tunneled via WireGuard.
- The Edge Proxy provides NAT and forwarding, serving as a unified IPv4 gateway for all backends.