Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted

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).

share|improve this answer
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 Aug 29 '12 at 23:32
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 Sep 2 '12 at 0:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.