Can Connect to OpenVPN but no internet access

16,867

Needed to add this to /etc/rc.local

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

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

Share:
16,867

Related videos on Youtube

bak202
Author by

bak202

Updated on September 18, 2022

Comments

  • bak202
    bak202 over 1 year

    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 208.67.222.222"
     push "dhcp-option DNS 208.67.220.220"
    

    all uncommented.

    In the global sysctl.conf file I also have:

    net.ipv4.ip_forward=1
    

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

    • Fabby
      Fabby about 9 years
      Where can't you access the Internet? On your client or on the server?
    • bak202
      bak202 about 9 years
      Client, the server can access it fine
    • Fabby
      Fabby about 9 years
      Could you give the output to route on the client before and after connecting to the server? Please edit your question to provise this.
  • James Hyde
    James Hyde about 8 years
    To the server's.
  • Chuck Dries
    Chuck Dries almost 8 years
    Any chance you can explain why we need this on the server side? What does it do?