Sshuttle: a VPN-based transparent proxy Using ssh
Sshuttle allows you to create a VPN connection from your computer to any remote server through ssh, as long as your server supports python2.3 or a later version. You must have the root permission on the local machine, but you can have a common account on the server.
You can run sshuttle multiple times on a single machine to connect to different servers, so that you can use multiple VPNs at the same time, sshuttle can forward all the traffic in your subnet to the VPN.
Install sshuttle in Ubuntu
Enter the following command in the terminal
sudo apt-get install sshuttle
Use sshuttle
Sshuttle syntax
sshuttle [options...][-r [username@]sshserver[:port]][subnets]
Option details
-R,-remote = [username @] sshserver [: port]
The remote host name and optional username, used to connect to the ssh port number of the remote server. For example, example.com, [email protected], [email protected]: 2222 or example.com: 2244.
Sshuttle example
Run the following command on the machine:
sudo sshuttle -r username@sshserver 0.0.0.0/0-vv
When it starts, sshuttle will create an ssh session to the server specified by-r. If-r is lost, it runs the client and server locally, which is sometimes useful for testing.
After connecting to the remote server, sshuttle will upload its (python) source code to the remote server and execute it. Therefore, you do not need to install sshuttle on the remote server, and there is no sshuttle version conflict between the client and the server.
More examples in the manual
All the local connections on the proxy are used for local testing without using ssh:
$ sudo sshuttle -v 0/0
Starting sshuttle proxy.
Listening on (‘0.0.0.0′,12300).
[local sudo]Password:
firewall manager ready.
c : connecting to server...
s: available routes:
s:192.168.42.0/24
c : connected.
firewall manager: starting transproxy.
c :Accept:‘192.168.42.106':50035 -> ‘192.168.42.121':139.
c :Accept:‘192.168.42.121':47523 -> ‘77.141.99.22':443.
...etc...
^C
firewall manager: undoing changes.
KeyboardInterrupt
c :Keyboard interrupt: exiting.
c : SW#8:192.168.42.121:47523: deleting
c : SW#6:192.168.42.106:50035: deleting
Test the connection to the remote server and automatically guess the Host Name and subnet:
$ sudo sshuttle -vNHr example.org
Starting sshuttle proxy.
Listening on (‘0.0.0.0′,12300).
firewall manager ready.
c : connecting to server...
s: available routes:
s:77.141.99.0/24
c : connected.
c : seed_hosts:[]
firewall manager: starting transproxy.
hostwatch:Found: testbox1:1.2.3.4
hostwatch:Found: mytest2:5.6.7.8
hostwatch:Found: domaincontroller:99.1.2.3
c :Accept:‘192.168.42.121':60554 -> ‘77.141.99.22':22.
^C
firewall manager: undoing changes.
c :Keyboard interrupt: exiting.
c : SW#6:192.168.42.121:60554: deleting
Via: http://www.ubuntugeek.com/sshuttle-a-transparent-proxy-based-vpn-using-ssh.html
Author: ruchi Translator: geekpi Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
Source: http://linux.cn/article-5528-1.html
This article permanently updates the link address: