I have set up an openvpn server, generated a certificate and downloaded it to my client machine.

After importing the client.ovpn file in the network manager, I can still ssh into the server itself, but cannot access the internet.

In my sever's openvpn server.conf, I have:

 push "redirect-gateway def1 bypass-dhcp"
 push "dhcp-option DNS"
 push "dhcp-option DNS"

all uncommented.

In the global sysctl.conf file I also have:


Is there anything I am missing configuration wise? What can I do to help debug the problem?

  • Where can't you access the Internet? On your client or on the server? – Fabby Mar 20 '15 at 19:24
  • Client, the server can access it fine – bak202 Mar 21 '15 at 19:50
  • Could you give the output to route on the client before and after connecting to the server? Please edit your question to provise this. – Fabby Mar 22 '15 at 8:06

Needed to add this to /etc/rc.local

iptables -t nat -A POSTROUTING -s ! -d -j SNAT --to $MY_IP

Which probably would have shown up had I checked out route earlier!

  • 2
    Server's /etc/rc.local or client's? – user323419 Nov 13 '15 at 19:44
  • To the server's. – Virtual Anomaly Mar 18 '16 at 23:01
  • 7
    Any chance you can explain why we need this on the server side? What does it do? – Chuck Dries Jul 3 '16 at 6:33

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.