Command line · 1 min read

Proxychains: How to Chain SOCKS5 Proxies

proxychains-ng forces any command-line program through one or more proxies, even tools that have no proxy option of their own. This guide shows how to install it, configure a SOCKS5 proxy, chain multiple hops, and avoid the classic DNS-leak mistake.

What proxychains does

proxychains-ng (the maintained fork of proxychains) is a tool that intercepts a program's network calls and forces them through a proxy — even programs that have no proxy setting. You prefix any command with proxychains4 and its TCP connections are routed through the proxies in your config. It is a staple on Kali and in pentesting workflows precisely because it works with tools that would otherwise connect directly.

It supports HTTP, SOCKS4 and SOCKS5 proxies, and it can chain several of them so your traffic passes through multiple hops in sequence. One important limitation to know upfront: proxychains works by hooking library calls, so it only affects dynamically linked programs — statically linked binaries and some tools bypass it. And it routes TCP, not raw UDP or ICMP (so it cannot proxy a normal ping).

It helps to understand the three chaining modes, because they behave very differently under failure. In strict_chain, traffic must pass through every listed proxy in the exact order given, and if any one is down the connection fails — this is what you want when the order and every hop matter. In dynamic_chain, proxychains skips any dead proxies and uses the rest in order, which is more forgiving for flaky lists. In random_chain, it picks a random subset for each connection, useful for spreading traffic but unpredictable. Whichever you pick, remember that every extra hop multiplies latency and adds another operator who can see your connection metadata, so chain deliberately rather than piling on proxies for a vague sense of extra safety.

Install and configure it

On Debian/Ubuntu/Kali; the config lives at /etc/proxychains4.conf or ~/.proxychains/proxychains.conf.

Install proxychains-ng

Install the package (apt install proxychains4 on Debian-based systems, or build proxychains-ng from source for the latest version).

Edit the config

Open the config file. Pick a chain mode (strict_chain, dynamic_chain or random_chain) and, critically, enable proxy_dns to route DNS through the chain.

Add your proxy at the bottom

In the [ProxyList] section add your SOCKS5 line: type, host, port and, for authenticated proxies, username and password. s4m SOCKS5 is on port 1080.

Run a command through it

Prefix any command with proxychains4, for example proxychains4 curl https://api.ipify.org, and confirm the exit IP is the proxy's, not yours.

Example proxychains4.conf

Enable proxy_dns to avoid leaking lookups, choose a chain mode, and list your proxies. In strict_chain, traffic passes through every proxy in order.

ini
# /etc/proxychains4.conf

# Route all connections through the proxies in ORDER, all must be up:
strict_chain
# (alternatives: dynamic_chain = skip dead ones; random_chain = random subset)

# CRITICAL: resolve DNS through the chain, not your local resolver:
proxy_dns

[ProxyList]
# type   host                 port  user  pass
socks5   proxy.s4m.online     1080  USER  PASS
# Chain a second hop by adding another line below (strict_chain):
# socks5 another.proxy.host   1080  USER2 PASS2

# Usage:
#   proxychains4 curl https://api.ipify.org
#   proxychains4 nmap -sT -Pn target      (TCP connect scan only)
Share this page
FAQ

Questions, answered

How do I stop proxychains from leaking DNS?

Enable the proxy_dns option in proxychains4.conf. Without it, your DNS lookups go to your local resolver and reveal the domains you are visiting even though the connections are proxied. With it, lookups are resolved through the proxy chain.

Can proxychains route ping or UDP traffic?

No. proxychains works at the TCP connection level by hooking library calls, so it cannot proxy raw ICMP (ping) or arbitrary UDP. It also only affects dynamically linked programs. Use a full VPN if you need to route non-TCP traffic transparently.

Can I chain multiple proxies with proxychains?

Yes. Add several lines to the [ProxyList] section. In strict_chain mode your traffic passes through all of them in order; dynamic_chain skips any that are down; random_chain uses a random subset. Each extra hop adds latency, so chain only as many as you need.

Get a SOCKS5 endpoint to chain

s4m provides authenticated SOCKS5 proxies on port 1080, ready to drop into proxychains. Metered pay-as-you-go, a free proxy list for testing, anonymous accounts and crypto payments.

People found this page by searching for

Real search phrases this page answers — the linked ones open the page that covers them in depth.