Skip to content

fix: use correct guest IP for slirp4netns port forwarding#216

Closed
claude-claude[bot] wants to merge 1 commit intowork-from-mainfrom
claude/fix-21637180032
Closed

fix: use correct guest IP for slirp4netns port forwarding#216
claude-claude[bot] wants to merge 1 commit intowork-from-mainfrom
claude/fix-21637180032

Conversation

@claude-claude
Copy link
Copy Markdown
Contributor

@claude-claude claude-claude bot commented Feb 3, 2026

CI Fix

Fixes CI #21635772224

Problem

The test_port_forward_rootless test was failing with timeout errors. The root cause was that slirp4netns port forwarding was failing with:

bad request: add_hostfwd: slirp_add_hostfwd failed

Investigation showed that the code was attempting to forward to 10.0.2.100, which slirp4netns rejected as an invalid guest address. This is because 10.0.2.100 is outside the standard slirp4netns guest IP range.

Solution

Changed the slirp4netns port forwarding configuration to use 10.0.2.15, which is the standard guest IP in slirp4netns's internal network (10.0.2.0/24 with gateway at 10.0.2.2).

Changes made:

  1. Updated slirp0 TAP device IP from 10.0.2.100 to 10.0.2.15
  2. Updated add_hostfwd API call to use guest_addr: "10.0.2.15"
  3. Updated DNAT iptables rule to redirect from 10.0.2.15 to the actual guest IP

The port forwarding flow remains the same:

host -> slirp4netns -> 10.0.2.15 -> DNAT -> guest (192.168.x.2)

This fix should resolve all 5 failing jobs that were experiencing port forwarding issues in rootless networking mode.


Generated by Claude | Fix Run

Change slirp4netns port forwarding from 10.0.2.100 to 10.0.2.15, which is
the standard guest IP in slirp4netns's internal network (10.0.2.0/24).

The previous configuration caused slirp_add_hostfwd to fail with:
  "bad request: add_hostfwd: slirp_add_hostfwd failed"

This was because 10.0.2.100 is not a valid guest address in slirp4netns's
view. The standard guest IP is 10.0.2.15 (with gateway at 10.0.2.2).

Changes:
- Update slirp0 TAP device IP from 10.0.2.100 to 10.0.2.15
- Update add_hostfwd guest_addr to use 10.0.2.15
- Update DNAT rule to redirect from 10.0.2.15 to actual guest IP

The port forwarding flow remains: host -> slirp4netns -> 10.0.2.15 -> DNAT -> guest

Fixes test_port_forward_rootless test failure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ejc3
Copy link
Copy Markdown
Owner

ejc3 commented Feb 3, 2026

Cherry-picked into PR #217 (http-proxy)

@ejc3 ejc3 closed this Feb 3, 2026
@ejc3 ejc3 deleted the claude/fix-21637180032 branch February 8, 2026 18:28
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.

1 participant