I've tried to follow the official documentation, but I can't seem to get it to work.

In my /etc/openvpn/server.conf I have

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

set and I have run iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE to NAT traffic via the Eth0 (which ifconfig says is my default gateway).

After this I restart the openvpn daemon by sudo service openvpn restart.

But it seems like my client devices are not able to connect to Internet when connected to my server. If I comment out the above lines from the server.conf file everything seems to work just fine (except that the traffic is not redirected). So it seems like I can connect to my OpenVPN server but have a problem redirecting.

Any ideas?

  • You need collect and post more data. For example when a client is connected with that option what does your route table. What happens when you do a traceroute for If you do a tcpdump on tun device on the VPN server what do you see when you do something simple on the client like trying to ping – Zoredache Dec 11 '13 at 23:59

Sometimes 'redirect-gateway def1' doesn't actually work when configured server-side (i.e. as a 'push' option). Try configuring that setting client-side (I.e. in your client config, make a new line called redirect-gateway def1).

I'm not sure why it does this, (maybe a miss-configuration?), but in any case, that should do the trick.

  • Sounds like a plan. Exactly how would that line look? I can only find redirect-gateway for server side in the documentation... – lindhe Dec 23 '13 at 11:20
  • I added redirect-gateway def1 (nothing else) in client.conf, but my life was not bettered. – lindhe Dec 23 '13 at 11:54

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.