Linux gives you choices — sometimes too many. When it comes to routing traffic through a SOCKS5 proxy, you have three fundamentally different approaches. I've used all three in production, and each has its place.
Method 1: Environment Variables (Quickest)
The simplest approach. Set these in your terminal:
export ALL_PROXY=socks5://username:password@gw.snowpad.io:9999
export http_proxy=socks5://username:password@gw.snowpad.io:9999
export https_proxy=socks5://username:password@gw.snowpad.io:9999What respects these: curl, wget, git, npm, pip, apt, and most CLI tools that implement proxy support.
What ignores them: GUI apps, browsers (most use system settings), and any tool that implements its own networking.
To make it permanent, add the exports to ~/.bashrc or ~/.zshrc.
Method 2: proxychains4 (Per-App Routing)
proxychains4 is my go-to for scraping. It uses LD_PRELOAD to hook into an application's network calls and redirect them through your proxy. No environment variables needed.
Install:
sudo apt install proxychains4Configure /etc/proxychains4.conf:
strict_chain
proxy_dns
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 gw.snowpad.io 9999 username passwordUsage:
proxychains4 curl http://httpbin.org/ip
proxychains4 python3 scraper.py
proxychains4 firefoxThe beauty of proxychains is that it works with any binary. You don't need the app to support proxies — proxychains forces it.
Method 3: redsocks + iptables (System-Wide Transparent Proxy)
This is the nuclear option. It creates a transparent proxy that intercepts all TCP traffic at the kernel level and routes it through SOCKS5.
Install redsocks:
sudo apt install redsocksConfigure /etc/redsocks.conf:
redsocks {
local_ip = 127.0.0.1;
local_port = 12345;
ip = gw.snowpad.io;
port = 9999;
type = socks5;
login = "username";
password = "password";
}iptables rules:
# Redirect all outgoing TCP through redsocks
iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 12345
iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to-port 12345This routes every TCP connection on your machine through Snowpad's SOCKS5 proxy. Use with caution — exclude local traffic to avoid routing loops.
Testing
curl --socks5 gw.snowpad.io:9999 -U username:password http://httpbin.org/ipFor a primer on what a proxy server actually does, read What Is a Proxy Server?.



