Comparing with shadowsocks, sshuttle is a much lightweight, open source alternative. All you need is a ssh server outside GFW.
To install, git clone
its repository from github, or use pip install
.
Then run the following command on client:
sshuttle --dns -r username@sshServer -x 192.168.0.0/16 -x 127.0.0.1 -D 0/0
.
Here option "--dns" is necessary to avoid DNS pollution inside GFW.
Add -v
or -vv
option ONLY for debug purpose, for it decreases connecting speed a lot.
-r
means "remote", so add your remote host outside GFW after it.
-x
means excluding all IPs in 192.168.x.x and localhost from forwarding.
-D
means start server as a daemon.
The last part of this command specifies which connections on client to use
by this proxy, "0/0" means all connections, which is the most common case.
For convenience, add the following lines into ~/.bash_aliases:
alias sv="sshuttle --dns -r username@sshServer -x 192.168.0.0/16 -x 127.0.0.1 -D 0/0"
alias lv="pgrep sshuttle"
alias kv="pkill sshuttle"
Now you can use sv
to start the vpn,
lv
to list vpn,
and kv
to kill vpn.