Skip to content

Anthropic

Tracking Claude Code network traffic via network namespaces

Written by an AI model from the linked sources and checked against them by a second model. How we work

All about: Claude Code versions and changes →
Image: patrickmccanna.net

A new technical breakdown examines where Claude Code actually sends requests when using the built-in WebFetch and WebSearch tools. The core question is whether the target server sees your IP address or Anthropic’s IP when the agent initiates a network connection.

Linux does not natively support process-level traffic interception, as AF_PACKET and tcpdump monitor the entire interface rather than a specific PID. The solution is using a network namespace, which provides the Claude process with a dedicated network interface containing only its traffic.

From there, you can identify connection destinations via TLS SNI hostnames and DNS queries without needing decryption. To read request bodies, you can use MITMproxy restricted to that single process.

The code and scripts are available in the CaptainMcCrank/claude-netns repository. Requirements include tcpdump, iproute2, iptables, Python 3, mitmproxy, and slirp4netns for rootless capture.

No comments yet. Be the first.

Join the conversation

Sign in to leave a comment. It appears after moderation.