Skip to content

Preserve real client source IP in builtin port driver via IP_TRANSPARENT#565

Open
AkihiroSuda wants to merge 1 commit intorootless-containers:masterfrom
AkihiroSuda:preserve-src-ip
Open

Preserve real client source IP in builtin port driver via IP_TRANSPARENT#565
AkihiroSuda wants to merge 1 commit intorootless-containers:masterfrom
AkihiroSuda:preserve-src-ip

Conversation

@AkihiroSuda
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda commented Mar 18, 2026

The src IP is now preserved in the case of nerdctl, but it seems still not propagated in the case of Docker (unless userland-proxy is set to false).

Fix #558

NOTE: used Claude Code

@AkihiroSuda AkihiroSuda added this to the v3.0.0 milestone Mar 18, 2026
@AkihiroSuda AkihiroSuda force-pushed the preserve-src-ip branch 3 times, most recently from c9fdbaf to b78c8fb Compare April 2, 2026 01:15
Use IP_TRANSPARENT socket option in the child process to bind outgoing
connections to the real client IP:port, so backend services see the
original source address instead of 127.0.0.1. This leverages
CAP_NET_ADMIN in the user namespace and policy routing
to complete TCP handshakes without iptables. Falls back gracefully to
normal dial on older kernels or when routing setup fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

builtin port driver: preserve src IP using IP_TRANSPARENT sockopt

1 participant