Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Use sshuttle to build a poor man’s VPN

#1
Use sshuttle to build a poor man’s VPN

Nowadays, business networks often use a VPN (virtual private network) for secure communications with workers. However, the protocols used can sometimes make performance slow. If you can reach reach a host on the remote network with SSH, you could set up port forwarding. But this can be painful, especially if you need to work with many hosts on that network. Enter sshuttle — which lets you set up a quick and dirty VPN with just SSH access. Read on for more information on how to use it.

The sshuttle application was designed for exactly the kind of scenario described above. The only requirement on the remote side is that the host must have Python available. This is because sshuttle constructs and runs some Python source code to help transmit data.

Installing sshuttle


The sshuttle application is packaged in the official repositories, so it’s easy to install. Open a terminal and use the following command with sudo:

$ sudo dnf install sshuttle

Once installed, you may find the manual page interesting:

$ man sshuttle

Setting up the VPN


The simplest case is just to forward all traffic to the remote network. This isn’t necessarily a crazy idea, especially if you’re not on a trusted local network like your own home. Use the -r switch with the SSH username and the remote host name:

$ sshuttle -r username@remotehost 0.0.0.0/0

However, you may want to restrict the VPN to specific subnets rather than all network traffic. (A complete discussion of subnets is outside the scope of this article, but you can read more here on Wikipedia.) Let’s say your office internally uses the reserved Class A subnet 10.0.0.0 and the reserved Class B subnet 172.16.0.0. The command above becomes:

$ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16

This works great for working with hosts on the remote network by IP address. But what if your office is a large network with lots of hosts? Names are probably much more convenient — maybe even required. Never fear, sshuttle can also forward DNS queries to the office with the –dns switch:

$ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16

To run sshuttle like a daemon, add the -D switch. This also will send log information to the systemd journal via its syslog compatibility.

Depending on the capabilities of your system and the remote system, you can use sshuttle for an IPv6 based VPN. You can also set up configuration files and integrate it with your system startup if desired. If you want to read even more about sshuttle and how it works, check out the official documentation. For a look at the code, head over to the GitHub page.


Photo by Kurt Cotoaga on Unsplash.



https://www.sickgaming.net/blog/2019/10/...-mans-vpn/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Fedora - Use FastAPI to build web services in Python xSicKxBot 0 1,640 06-06-2020, 02:32 AM
Last Post: xSicKxBot
  Fedora - Use FastAPI to build web services in Python xSicKxBot 0 1,593 06-01-2020, 11:40 PM
Last Post: xSicKxBot
  Fedora - Build your own cloud with Fedora 31 and Nextcloud Server xSicKxBot 0 1,667 01-28-2020, 05:00 AM
Last Post: xSicKxBot
  Fedora - Build a virtual private network with Wireguard xSicKxBot 0 1,770 10-29-2019, 05:00 AM
Last Post: xSicKxBot
  Fedora - How to build Fedora container images xSicKxBot 0 1,774 09-10-2019, 08:14 PM
Last Post: xSicKxBot
  Fedora - Fedora job opening: Fedora Community Action and Impact Coordinator (FCAIC) xSicKxBot 0 1,680 07-11-2019, 10:39 AM
Last Post: xSicKxBot
  Fedora - Use udica to build SELinux policy for containers xSicKxBot 0 1,695 05-07-2019, 02:22 AM
Last Post: xSicKxBot
  Fedora - Contribute at the Fedora Test Day for Fedora Modularity xSicKxBot 0 1,826 03-28-2019, 11:12 PM
Last Post: xSicKxBot
  Fedora - Build a Django RESTful API on Fedora. xSicKxBot 0 1,726 01-21-2019, 06:20 PM
Last Post: xSicKxBot
  Fedora - How to Build a Netboot Server, Part 4 xSicKxBot 0 1,777 01-14-2019, 02:18 PM
Last Post: xSicKxBot

Forum Jump:


Users browsing this thread:

Forum software by © MyBB Theme © iAndrew 2016