proxy-ns is a Linux-specific command line tool to force any program to use your socks5 proxy server.
It has several advantages over proxychains
:
- Supports both TCP and UDP
- Works for statically linked programs
proxy-ns is available at AUR.
You can manually clone this repo, then use make install
.
git clone https://github.com/OkamiW/proxy-ns.git
cd proxy-ns
make && sudo make install
First, generate your config file:
proxy-ns -g
By default, proxy-ns uses config file at
$XDG_CONFIG_HOME/proxy-ns/config.json
. In case XDG_CONFIG_HOME
is
not set, it would be $HOME/.config/proxy-ns/config.json
.
Here’s the default config file:
{
"tun_name": "tun0",
"tun_ip": "10.0.0.1/24",
"socks5_address": "127.0.0.1:1080",
"fake_dns": true,
"fake_network": "240.0.0.0/4",
"dns_server": "9.9.9.9"
}
Normally you only need to change socks5_address
.
FakeDNS can avoid a separate DNS roundtrip to improve latency, but it has its own limitations:
- All domains are resolved to
fake_network
, some programs may not work as expected(eg.geoiplookup
). - Some programs may not use your system DNS resolver. FakeDNS won’t work for them.
Because proxy-ns creates a new network namespace.
For many distributions, /proc/sys/net/ipv4/ping_group_range
defaults
to 1 0
in new network namespace, which disallow ping for all groups.
Since socks5 doesn’t support icmp, ping
would be meaningless inside
proxy-ns anyway.
Your socks5 server may not support UDP ASSOCIATE.
Usually, you can workaround this by enabling fake_dns
(it’s enabled
by default).
But some programs resolve domains themselves. You have to enable UDP support for your proxy server to use them.