Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to use OpenVPN on my Ubuntu 12.04 web server, but as soon as OpenVPN is running, I can't connect to the internet. Befor starting OpenVPN, route says:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         ip-172-31-16-1. 0.0.0.0         UG    100    0        0 eth0
172.31.16.0     *               255.255.240.0   U     0      0        0 eth0

and after:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.200.4.1      128.0.0.0       UG    0      0        0 tun0
default         172.31.16.1     0.0.0.0         UG    100    0        0 eth0
10.200.4.0      *               255.255.252.0   U     0      0        0 tun0
128.0.0.0       10.200.4.1      128.0.0.0       UG    0      0        0 tun0
172.31.16.0     *               255.255.240.0   U     0      0        0 eth0
184.170.137.2   172.31.16.1     255.255.255.255 UGH   0      0        0 eth0

184.170.137.2 is the VPN. The OpenVPN HOWTO suggests to use

iptables -t nat -A POSTROUTING -s 10.200.4.0/22 -o eth0 -j MASQUERADE

which didn't work => still no connection to the internet possible.

Can anyone help?

share|improve this question
1  
Contact your VPN provider. –  Michael Hampton Oct 3 '13 at 15:05
    
Disable any gateway redirection. Perhaps start with route-nopull. –  Zoredache Oct 3 '13 at 16:23
    
I've tried route-nopull. After, I was able to connect to the internet, but with my own IP address, not the VPN's. In the log I found that sudo iptables -t nat -A POSTROUTING -s 10.200.4.0/22 -o eth0 -j MASQUERADE throws sudo: unable to resolve host ip-172-31-26-178 (172.31.26.178 is the internal IP). Any help? –  Simon Oct 4 '13 at 16:34
    
If I do the following, I can use the VPN for a single website: >> route add -net {website ip} netmask 255.255.255.255 gw 10.200.4.1 dev tun0 >> route del -net 0.0.0.0 netmask 128.0.0.0 dev tun0 >> route del -net 128.0.0.0 netmask 128.0.0.0 dev tun0. How can I change this to work for the whole web? –  Simon Oct 4 '13 at 18:28

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.