AdHoc WiFi network that routes traffic through an SSH tunnel

2

1

I just bought a Raspberry Pi and I want to route an ad hoc wireless network interface fully through an SSH tunnel that was created using another wireless interface.

I want to do this so that I can have a secured and private connection to the internet at places with public WiFi. I know this would be easier to do all on one computer, but I would like to have it on the Raspberry Pi too since I use it for other network related things when I am using the internet, and then just simply connect to the ad hoc network from my laptop/phone. This will really help me with my iPhone because it does not support an SSH tunnel locally.

Clay Freeman

Posted 2012-08-29T23:25:27.607

Reputation: 173

Answers

0

SSH tunnels are "port-based" - so if you want to force all traffic on the WLAN interface through it, you need to first block all outgoing traffic on the WLAN interface (typically wlan0) except traffic on the tunnel ports and your server IP using iptables.

An OpenVPN tunnel, which creates a virtual network adapter, will allow you to be more transparent to applications and will work nicer, though. To secure it properly, you need to disallow all outgoing traffic on the WLAN interface in a manner similar to above. However, you want to make sure your tun0 or whatever interface is set to ACCEPT on outgoing traffic (really don't need to put further rules on that since it only works when you authenticate with your OpenVPN server).

LawrenceC

Posted 2012-08-29T23:25:27.607

Reputation: 63 487

Would I need to setup OpenVPN on the server and the RPi? I want the most simple solution for this that is possible. – Clay Freeman – 2012-08-29T23:32:20.577

You would need to write a server configuration file for OpenVPN running on your server and write a client configuration file for OpenVPN running on your RPi from what I glean from your situation. – LawrenceC – 2012-09-02T00:15:49.860