Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


OpenVPN on Ubuntu 12.04; Connected, but no internet access
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

OpenVPN on Ubuntu 12.04; Connected, but no internet access

FreekFreek Member
edited September 2012 in Help

Yes, another OpenVPN topic. Yet again about being connected but not having internet access, but this time on Ubuntu 12.04.
I tried using the 'knowledge' I gained about OpenVPN in the past, but I haven't been able to solve this myself.

First of all, it was a challenge for a noob like me to get it running on Ubuntu 12.04. Apparently there's an bug in the package which gives an error about a missing file (https://bugs.launchpad.net/ubuntu/+source/openvpn/+bug/998918). However, the file is there, only in another location. This can be solved by using a slightly adapted command which can be read in the last comment from the link above:

cd /etc/openvpn/easy-rsa/2.0
sudo ln -s openssl-1.0.0.cnf openssl.cnf

After that, I was unable to start dnsmasq. It complained about the port/address being in use. Apparently bind9 runs by default on Ubuntu 12.04 so to solve that just do an apt-get remove bind9 and it should start.

Last but not least, I added the following rule to my IPTables because I had to use it in the past to get internet access working:
iptables -t nat -A POSTROUTING -o venet0 -j SNAT --to-source VPSIP

Sadly, this did not do the trick this time.

Any ideas?

I am running Ubuntu 12.04 on a OpenVZ VPS and setup OpenVPN using this tutorial from Linode in combination with the changes described above:
https://library.linode.com/networking/openvpn/ubuntu-10.10-maverick

Thanks!

Comments

  • NyrNyr Community Contributor, Veteran

    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to VPSIP

    Assuming you are using 10.8.0.0/24 for your VPN.

  • TazTaz Member
    edited September 2012

    iptables -t nat -A POSTROUTING -s 1.2.3.0/24 -j SNAT --to x.x.x.x

    Edit: Nyr beat me to it.

  • @Nyr said: Assuming you are using 10.8.0.0/24 for your VPN.

    Yes I am. Just following the tutorials from Linode :)

  • echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o venet0 -j SNAT --to vps.ip.address.xxx
    
    or
    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to x.x.x.x
    
    iptables-save > /etc/iptables.conf
    nano /etc/network/if-pre-up.d/iptables
    #!/bin/sh
    iptables-restore < /etc/iptables.conf
    
    chmod +x /etc/network/if-pre-up.d/iptables
  • I feel dumb. I made a typo in the IP with regard to
    iptables -t nat -A POSTROUTING -o venet0 -j SNAT --to-source VPSIP
    I corrected the error and now it works accordingly... my bad.
    Hopefully those who are trying to get OpenVPN running on Ubuntu 12.04 can benefit from my tips in the first post though!

    Thanks guys!!

  • why do you need dnsmasq? isn't using google dns,opendns etc pretty much the same thing?

  • Hello i know you are a person who can do open vpn on debian. I need a good open vpn for voip on debian. can you teach me? how can configure open vpn on debian with connect to vpn server? Khan.

  • @cosmicgate said: why do you need dnsmasq? isn't using google dns,opendns etc pretty much the same thing?

    AFAIK You need dnsmasq to push the DNS to your clients. Sure you can set OpenDNS or Google DNS in your DNSMasq file, but running your own can also be done.

    @reza_50 said: Hello i know you are a person who can do open vpn on debian. I need a good open vpn for voip on debian. can you teach me? how can configure open vpn on debian with connect to vpn server? Khan.

    I know how to do it on Ubuntu, but Debian is pretty similar.
    Follow this tutorial:
    http://library.linode.com/networking/openvpn/debian-6-squeeze

    Good luck!

  • Hi Can I talk with you by skype/msn or yahoo massanger? If you have then pls send me then i can add you & talk with you live.

    Khan.

  • i can install openvpn on debian np but i dont know where i need to set public ips, default gateway ip, dns & subnet musk? also where i put vpn server ip on debian configure?

    Khan.

  • @reza_50 said: i can install openvpn on debian np but i dont know where i need to set public ips, default gateway ip, dns & subnet musk? also where i put vpn server ip on debian configure?

    I have no idea what you are trying to accomplish here so I am sorry but I cannot help you. I can only install a basic OpenVPN deployment and thats it.

  • how can connect debian server with main vpn server?

  • dmmcintyre3dmmcintyre3 Member
    edited September 2012

    @Freek said: AFAIK You need dnsmasq to push the DNS to your clients. Sure you can set OpenDNS or Google DNS in your DNSMasq file, but running your own can also be done.

    push "nameserver 4.2.2.1 4.2.2.2" in your openvpn server config will set the dns on the client, without you needing to run dnsmasq.

Sign In or Register to comment.