What is a proxy chain?
A proxy chain routes your traffic through two or more proxies in sequence: you connect to proxy A, which connects to proxy B, which connects to the destination. The destination sees only the last proxy's IP, and each proxy only knows its immediate neighbours.
Chaining is used for layered privacy, for reaching a network through an intermediate gateway, and for combining capabilities (for example, an internal corporate proxy followed by an external commercial proxy).
How chaining works
Each hop uses the tunnelling features of the proxy protocol:
- With SOCKS5, the client asks proxy A to connect to proxy B, then performs a SOCKS handshake with B through that connection, and so on.
- With HTTP proxies, the client uses CONNECT through A to reach B, then CONNECT through B to the target.
Tools automate this.
proxychains-ng
proxychains-ng (proxychains4) is a popular Linux/macOS tool that forces TCP connections from a program through a list of proxies by intercepting network calls.
Example /etc/proxychains4.conf (or ~/.proxychains/proxychains.conf):
strict_chain
proxy_dns
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 203.0.113.10 1080 user1 pass1
http 198.51.100.20 8080 user2 pass2Run a program through it:
proxychains4 curl https://api.ipify.orgChain modes
| Mode | Behaviour |
|---|---|
strict_chain | All proxies in order; fails if any is down |
dynamic_chain | All proxies in order, skipping dead ones |
random_chain | A random selection of chain_len proxies each time |
proxy_dns sends DNS lookups through the chain to avoid DNS leaks.
Costs of chaining
- Latency adds up with each hop.
- Reliability multiplies down: a chain of three proxies that are each up 99% of the time is up about 97% of the time.
- Throughput is limited by the slowest hop.
- Complexity makes debugging harder.
When chaining makes sense
- Reaching an external proxy from inside a network that only allows a corporate proxy.
- Separating trust: no single proxy sees both your real IP and the destination.
- Security testing and research environments.
When it doesn't
For scraping, automation, sneakers and social media, chaining adds latency and failure points without meaningful benefit. A single well-chosen proxy is better. For privacy, a reputable VPN or Tor is usually more practical. See proxy vs VPN.
Example chains and what they achieve
| Chain | Purpose |
|---|---|
| Corporate proxy → commercial proxy | Reach external proxies from a locked-down network |
| SSH tunnel → SOCKS5 proxy | Encrypt the first hop on untrusted networks |
| Tor → proxy | Add a fixed exit IP after Tor (rarely useful; often blocked) |
| Proxy A (country X) → Proxy B (country Y) | Separate knowledge between providers |
Proxy tip: When troubleshooting, it helps to have a second, known-good proxy to compare against. A small pay-as-you-go balance from Geonode works well for that, and its dashboard shows usage and active sticky sessions. More in using Geonode in your browser.
Using SSH as the first hop
SSH dynamic forwarding is a simple, encrypted first hop:
ssh -N -D 1080 user@your-serverThen in proxychains:
[ProxyList]
socks5 127.0.0.1 1080
http gate.example.com 7777 USER PASSTraffic is encrypted from your machine to your server, then goes through the commercial proxy. This protects proxy credentials and traffic metadata on untrusted local networks.
Chaining in code
Most HTTP libraries support one proxy. To chain, run a local forwarder that itself uses an upstream proxy, then point your code at the local forwarder. For example, gost supports multi-hop forwarding:
gost -L http://127.0.0.1:8080 -F socks5://127.0.0.1:1080 -F http://USER:PASS@gate.example.com:7777Your code then uses http://127.0.0.1:8080 as a single proxy.
Debugging chains
- Test each hop individually with curl.
- Add hops one at a time.
- Use
strict_chainwhile debugging to see exactly which hop fails. - Check timeouts; long chains need longer timeouts.
Alternatives to chaining
| Goal | Simpler alternative |
|---|---|
| Hide your IP from the target | A single good proxy |
| Hide your traffic from your local network | A VPN |
| Strong anonymity | Tor Browser |
| Reach external proxies from a corporate network | Ask IT for an approved route |
See proxy vs VPN and SOCKS5 proxies.
Chaining and anonymity: a realistic view
Chaining hides your IP from the destination and splits knowledge between hops, but it doesn't make you anonymous by itself. Cookies, browser fingerprints, account logins and behaviour can still identify you. If anonymity is the real goal, tools built for it (such as Tor Browser) handle many of these issues together. See proxy anonymity levels and browser fingerprinting and proxies.
Measuring what each hop costs
Every hop in a chain adds latency, and the cost compounds. Before committing to a chain, measure it one hop at a time with curl's timing output:
# one hop: the HTTP proxy only
curl -s -o /dev/null -w 'tls:%{time_appconnect} total:%{time_total}\n' \
-x http://USER:PASS@gate.example.com:7777 https://example.com
# two hops: a SOCKS5 proxy first, then the HTTP proxy
curl -s -o /dev/null -w 'tls:%{time_appconnect} total:%{time_total}\n' \
--preproxy socks5h://127.0.0.1:1080 \
-x http://USER:PASS@gate.example.com:7777 https://example.comRun each version 20 to 30 times and compare medians. As a rule of thumb, each hop adds at least one round trip for its connection and another for the tunnel set-up, so two distant hops can easily double or triple the time to an established connection.
Questions to ask with the numbers in front of you:
- Does the extra hop achieve something you need, such as reaching a whitelisted server or adding an encrypted first leg, or is it just habit?
- Can hops be closer together? A first hop in the same region as the second costs far less.
- Can connections be reused? Keep-alive spreads the set-up cost over many requests.
For the anonymity side of chaining, see the realistic view above; for SSH as a first hop, SOCKS5 proxies; and for general speed testing, how to test proxy speed.
Key takeaways
- A proxy chain routes traffic through multiple proxies; the destination sees only the last hop.
- proxychains-ng supports strict, dynamic and random chains, with
proxy_dnsfor remote DNS. - Each hop adds latency and reduces reliability.
- Chains are useful for corporate network traversal and separating trust, rarely for scraping or account work.
- An SSH tunnel makes an easy encrypted first hop. See socks5 proxies.
FAQ
Is proxy chaining more anonymous?
It can separate knowledge between hops, but your browser fingerprint, cookies and behaviour still identify you.
Can I chain residential proxies?
Technically yes, but it's rarely useful and makes everything slower.
Editorial note: Proxy providers change their pools, features and prices often, so treat any figures here as typical ranges at the time of writing and confirm current terms with the provider before you buy.