My question: How do I use my already existing OpenVPN setup to enable secure, remote web surfing and email checking from open wireless hotspots?

edit3 - Bride of Edit The final solution is below but in case no one reads that far the final solution was to forward the data using: sudo -s echo 1 > /proc/sys/net/ipv4/ip_forward

edit2 I've implemented the directions in the "How To" but all I get is my internet connection timing out. What I did was enable push "redirect-gateway def1" in the conf and then set iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE. This is as they suggest in the manual but it does not work.

edit: I see in their manual that they explain the first bit of how to do this and then say "The server will need to be configured to deal with this traffic somehow," and offer a few options. But that "somehow" has me bugged because it seems like there should a "best way" and I'm not sure I understand enough about the options provided to determine this way.

Some long winded details:

I am running Ubuntu and have OpenVPN up and working fine as a server. My client machine connects fine as well. However, that just gets me a secure connection to my home network.

What I want is to be able to access my VPN server and surf the web or check email securely from anywhere with an open wireless connection. I am frequently in China and having secure, unblocked access would be a boon (especially since I like to work from tea houses and coffee shops and I've already had a password sniffed and hacked once).

I already know how to tunnel over SSH via a SOCKS proxy using something like:

ssh -ND 8887 -p 22 yaddayadda@84.26.421.796  

but since I have OpenVPN I figure why not try it? So... what are the steps involved in making it so I can connect to my VPN and the surf and check mail to my hearts content (slowly to be sure but at least it wold be secure). Thx!


it's worth checking your server is set up to forward/route packets

on my machine, I can check that with "cat /proc/sys/net/ipv4/ip_forward" if that's 0, do "echo 1 > /proc/sys/net/ipv4/ip_forward"

if that isn't it, and you don't have the FORWARD iptables chain denying you somehow, I'd post a traceroute and see how far it gets.

  • I entered my comment without refreshing... oops. Your tip is the correct answer. For some reason even using sudo would still deny me permission to do this but sudo -s (logging me in as root) did it. Thanks! – gaoshan88 May 24 '10 at 7:34

The needed command was: sudo -s echo 1 > /proc/sys/net/ipv4/ip_forward

Note the sudo -s... for some reason a simple sudo would not cut it on my server.

  • 1
    sudo wouldn't work because the redirector (>) runs as your user, not root (and you don't have permission to write to /proc). – squircle May 24 '10 at 19:48
  • Super informative comment... thanks! I suppose I could have looked it up but this is quite useful to know. – gaoshan88 May 26 '10 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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