Ubuntu – How to share WiFi/hotspot over SSH tunnel

hot-spotsshtunnelwireless

I have created a SSH tunnel on my laptop connected to LAN. I want to share the internet via WiFi/hotspot, but over the SSH tunnel. I mean any computer using this wireless should connect to the internet via the SSH tunnel (automatically without setting proxy).

In other words, I want to set the proxy setting only on my laptop (e.g., 127.0.0.1:1028), and any computer using the WiFi/hotspot from my laptop should be able to use internet without any proxy setting.

Best Answer

What you want is not possible with pure SSH (i.e. the -D proxy option to create the poor-mans VPN).

Here's two options that do work, though:

  1. use sshuttle (available in the repositories) and tell it to forward all traffic from the subnet of your hotspot through the "VPN". See the manpage for more info.
  2. set up OpenVPN on the remote system and your local system. The traffic of the connected hotspot users should go through the VPN by default. You might also want to look at this serverfault question.