Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I set up Openvpn in a Ubuntu vps following this.

This is my client route -n

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface       UG    0      0        0 tun0         UG    0      0        0 ppp0 UGH   0      0        0 tun0 UH    0      0        0 tun0 UH    0      0        0 ppp0       UG    0      0        0 tun0     U     1000   0        0 ppp0 UGH   0      0        0 ppp0

On client, I can ping, but other than that I don't seem to have the Internet access. I tried mtr, I get

Host                          Lost% ...
1.                    0.0% ...
2. ???

While on server, mtr shows the path.

Any advice what might have gone wrong? Thanks!

share|improve this question
up vote 2 down vote accepted

You should set up NAT & routing correctly on the server.

If mtr from the server is working correctly, but not from the clients, you should add a rule like this on the server:

# iptables -A POSTROUTING -s -j SNAT --to-source <public IP of server>

Also, be sure that routing is enabled on the server:

# sysctl net.ipv4.ip_forward 
net.ipv4.ip_forward = 0   <<< disabled
# sysctl net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1   <<< enabled

Or if you want to enable it at startup, change net.ipv4.ip_forward to 1 in /etc/sysctl.conf and run sysctl -p.

share|improve this answer

Just in case it's useful, although I see the other answer has already been accepted...

@petrus' answer assumes that you want all internet traffic to go through the OpenVPN network. That's the way to do it if that's what you want.

However, it is common to only need the OpenVPN for accessing resources in that network (e.g. a fileserver/intranet), and to use your normal internet connection for general internet access. In this case you can speed things up by telling your client machine to not route all traffic through OpenVPN. How you do this will depend on your client software and OS, but I thought I'd offer it as I'd noticed that this was happening to my OpenVPN clients and causing an unnecessary slowdown.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.