1

I have ubuntu 14.04 server installed inside a VirtualBox VM running on OS X 10.10. My goal is to configure OpenVPN on ubuntu in order to access via the host system. This is a testrun for a OpenVPN installation on a remote server.

In order to do so, I followed this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-14-04

Everything went OK, and I could initially connect via Tunnelblick to the server. However 60s later Tunnelblick tells me that I might have lost internet connection due to a misconfigured openvpn config. So I disconnect and stop tunnelblick.

Unfortunatelly I can no longer access my VM from OSX. A tracert shows, that it tries to connect first over my router and then second to the internet provider which is unecessary. The regular way would be just one hop to the IP as specified inside /etc/hosts

After rebooting the mac everything is fine again. I can reproduce by trying to connect via tunnelblick again. Same thing and I have to reboot.

Does somebody have an idea how to fix that?

  • No doubt you server has push "redirect-gateway" which forces all your client data through the VPN but you have not configured your server correctly. This is the OpenVPN Documentation - This is the Link specific to your problem. – dotvotdot Sep 29 '15 at 22:08
  • Thank you. That is correct, I have followed the "wrong" tutorial and meanwhile fixed it. – merlin Sep 29 '15 at 22:43
0

The correct answer is mentioned in this comment by dotvotdot.

As per, this link

Add the following directive to the server configuration file:

  push "redirect-gateway def1"

If your VPN setup is over a wireless network, where all clients and the server are on the same wireless subnet, add the local flag:

  push "redirect-gateway local def1"

Pushing the redirect-gateway option to clients will cause all IP network traffic originating on client machines to pass through the OpenVPN server. The server will need to be configured to deal with this traffic somehow, such as by NATing it to the internet, or routing it through the server site's HTTP proxy.

On Linux, you could use a command such as this to NAT the VPN client traffic to the internet:

  iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

This command assumes that the VPN subnet is 10.8.0.0/24 (taken from the server directive in the OpenVPN server configuration) and that the local ethernet interface is eth0.

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.