Skip to content

feat: add Docker router-based testbed#18

Closed
srene wants to merge 6 commits into
topdiscfrom
docker-testbed
Closed

feat: add Docker router-based testbed#18
srene wants to merge 6 commits into
topdiscfrom
docker-testbed

Conversation

@srene

@srene srene commented Apr 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Docker testbed mode (--docker) with a single router container simulating diverse public IPs and NAT behaviors via iptables
  • Three node types: public, NATted (unreachable), port-forwarded (reachable on discv5 port)
  • Virtual public IPs scattered across different /8, /16, /24 ranges so IP diversity scoring works correctly
  • Per-node latency via tc netem, configurable from file or random uniform
  • Replaces old NetworkDocker (per-node bridge with private 172.20.x.x IPs that bypassed IP limits)

New files

  • testbed/docker/node/Dockerfile + entrypoint.sh — geth devp2p node container
  • testbed/docker/router/Dockerfile + entrypoint.sh — iptables NAT rules engine
  • testbed/discv5-docker-config.json — example config with NAT params
  • Updated testbed/testbed/network.py with NetworkDockerRouter class
  • Updated testbed/README.md with full documentation

Test plan

  • Test on Linux machine (ssh sergi@london)
  • Verify router iptables rules are applied correctly
  • Run 100-node experiment with mixed NAT (50 public + 20 port-forwarded + 30 NATted)
  • Verify IP diversity scoring works (non-private IPs)
  • Verify NATted nodes can register but not serve as registrars
  • Verify port-forwarded nodes are reachable on discv5 port
  • Compare results with local mode baseline

Closes #17

@srene
srene requested a review from fjl as a code owner April 13, 2026 11:36
@srene srene changed the title Add Docker testbed with router-based NAT simulation testbed: add Docker testbed with router-based NAT simulation Apr 13, 2026
@srene srene changed the title testbed: add Docker testbed with router-based NAT simulation feat: add Docker testbed with router-based NAT simulation Apr 13, 2026
@github-actions github-actions Bot closed this Apr 13, 2026
@srene srene reopened this Apr 13, 2026
@datahop datahop deleted a comment from github-actions Bot Apr 13, 2026
@srene srene changed the title feat: add Docker testbed with router-based NAT simulation feat: add Docker router-based testbed Apr 13, 2026
@github-actions github-actions Bot closed this Apr 13, 2026
@datahop datahop deleted a comment from github-actions Bot Apr 13, 2026
@srene srene reopened this Apr 13, 2026
@srene
srene marked this pull request as draft April 14, 2026 07:15
@fjl

fjl commented Apr 28, 2026

Copy link
Copy Markdown
Member

does this work now?

srene added 6 commits April 28, 2026 22:13
Add a Docker-based testbed mode (--docker) with a single router container
that simulates realistic network conditions:

- Router assigns virtual public IPs from scattered /8 ranges via iptables
- Three node types: public (full DNAT), port-forwarded (DNAT on discv5
  UDP port only), NATted (SNAT only, no inbound)
- Per-node network latency via tc netem
- Public IPs and latencies configurable from file or generated

New config parameters: nattedNodes, portForwardedNodes, minLatencyMs,
maxLatencyMs, publicIpFile, latencyFile.

Replaces the old NetworkDocker class which used per-node bridge networks
with private IPs (172.20.x.x) that bypassed IP diversity scoring.

Closes #17.
@srene

srene commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

does this work now?

i dont think so. it needs to be completed and tested

@srene

srene commented May 3, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of #51, which simplifies the Docker testbed by dropping NAT entirely.

The router-based design here (single router container with iptables NAT classes for public / port-forwarded / natted) was solving a problem that turned out to be out of scope: NAT-class simulation isn't needed for the testbed's actual purpose. With NAT removed, the router has no remaining role — each container can simply have its real IP on a single bridge.

#51 keeps what mattered:

  • Per-node configurable IP (docker run --ip)
  • Per-node bandwidth + latency (tc htb + tc netem inside each container)
  • IP layout across distinct /24s (node N → 10.100.N.1) to exercise regBucketSubnet=24

…and drops the rest:

  • No router container, no dummy0, no iptables NAT chain
  • No host-level iptables --flush (no sudo required)
  • No virtual public IPs

Net change vs this PR: ~⅓ the testbed code. Easier to reason about, no privileged host setup beyond --cap-add=NET_ADMIN per container.

The testbed scope here drifted away from what's actually useful for protocol testing. #51 reflects the simpler scope. Will validate on a Linux host before marking #51 ready for review.

@srene srene closed this May 3, 2026
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.

Task 3.1.1: Simulate node churn and failure modes in testbed

2 participants