Sshuttle: a VPN-based transparent proxy Using ssh

Source: Internet
Author: User
Tags ssh port

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

  1. sudo apt-get install sshuttle

 

Use sshuttle

 

Sshuttle syntax
  1. 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:

  1. 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:

  1. $ sudo sshuttle -v 0/0
  2. Starting sshuttle proxy.
  3. Listening on (‘0.0.0.0′,12300).
  4. [local sudo]Password:
  5. firewall manager ready.
  6. c : connecting to server...
  7. s: available routes:
  8. s:192.168.42.0/24
  9. c : connected.
  10. firewall manager: starting transproxy.
  11. c :Accept:‘192.168.42.106':50035 -> ‘192.168.42.121':139.
  12. c :Accept:‘192.168.42.121':47523 -> ‘77.141.99.22':443.
  13. ...etc...
  14. ^C
  15. firewall manager: undoing changes.
  16. KeyboardInterrupt
  17. c :Keyboard interrupt: exiting.
  18. c : SW#8:192.168.42.121:47523: deleting
  19. c : SW#6:192.168.42.106:50035: deleting

Test the connection to the remote server and automatically guess the Host Name and subnet:

  1. $ sudo sshuttle -vNHr example.org
  2. Starting sshuttle proxy.
  3. Listening on (‘0.0.0.0′,12300).
  4. firewall manager ready.
  5. c : connecting to server...
  6. s: available routes:
  7. s:77.141.99.0/24
  8. c : connected.
  9. c : seed_hosts:[]
  10. firewall manager: starting transproxy.
  11. hostwatch:Found: testbox1:1.2.3.4
  12. hostwatch:Found: mytest2:5.6.7.8
  13. hostwatch:Found: domaincontroller:99.1.2.3
  14. c :Accept:‘192.168.42.121':60554 -> ‘77.141.99.22':22.
  15. ^C
  16. firewall manager: undoing changes.
  17. c :Keyboard interrupt: exiting.
  18. 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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.