Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When using OpenVPN on Linux, I can't connect to anything on the internet. Firefox shows everything except my own router as "not found". And curl -I google.com, for example, gives curl: (6) Could not resolve host: google.com.

This is very different from Windows, where I can actually access any part of the internet (that I have tried so far) using OpenVPN with the same certificate and provider.

When not using OpenVPN on Linux, my systems connect just as well as with Windows.

(I'm running the VPN as a client in North America; the server is presumably somewhere in Europe.)

So what am I not doing that I need to do in order to connect?

Edit to answer a few questions:

curl -I 74.125.224.72 (a Google ip) indeed gives a valid response (HTTP/1.1 200 OK, etc.).

Not sure what the VPN peer ip is, but ping 178.73.207.97 (the ip seen below) gives 64 bytes from 178.73.207.97: icmp_seq=1 ttl=64 time=#.### ms (the #.### being various amounts of milliseconds). The ping goes on more than 300 times, so I think that works, but I could be wrong.

Output of ip addr (I can't copy and paste between machines, so I may have made some errors below):

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0 <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:6f:e2:eb brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe6f:e2eb/64 scope link
       valid_lft forever preferred_lft forever
3: tap0 <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 2a:d6:30:43:a2:8e brd ff:ff:ff:ff:ff:ff
    inet 178.73.207.97/24 brd 178.73.207.255 scope global tap0
       valid_lft forever preferred_lft forever
    inet6 fe80:28d6:30ff:fe43:e28e/64 scope link
       valid_lft forever preferred_lft forever

Output of ip route:

0.0.0.0/1 via 178.73.207.1 dev tap0
default via 10.0.2.2 dev eth0  proto static
10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15  metric 1
80.67.8.218 via 10.0.2.2 dev eth0
128.0.0.0/1 via 178.73.207.1 dev tap0
178.73.207.0/24 dev tap0  proto kernel  scope link  src 128.73.207.97

Output of iptables -L -nv:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

I downloaded the config files from the service provider, along with a certificate. On Linux, I just run sudo openvpn config.ovpn (inside Konsole). On Windows, I just use the GUI (not sure if that's relevant).

config.ovpn contains (lines listed with address actually contain an address (not an ip), which I removed for privacy):

client

dev tap

proto udp

remote address 1194
remote address 1195
remote address 1196
remote address 1197
remote address 1198
remote address 1199
remote address 1200
remote address 1201

remote-random

resolv-retry infinite

auth-user-pass

nobind

persist-key
persist-tun

ns-cert-type server

ca ca.crt
comp-lzo

reneg-sec 0

verb 3

Aside from using the config file and certificate, I just installed openvpn (compiled to /usr/local/sbin and via apt-get to /usr/sbin; the above information is using the one in /usr/sbin/openvpn but they result in the same behaviour).

Having looked at the above (though I'm no expert), it looks like OpenVPN is active, but the system is still defaulting to eth0 instead of tap0. Question remains the same: "What am I not doing that I need to do in order to connect?"

share|improve this question
    
Have you tried if you can access e.g. google.com via an IP address. If that works, your VPN has in incorrectly setup DNS lookup –  Anthon Apr 29 at 20:50
    
With such problems you should always give the outputs of (a) ip addr, (b) ip route, (c) and iptables -L -nv` (shortened to the relevant output, i.e. at least INPUT and OUTPUT). Furthermore you should use tcpdump to check what happens on that interface. Can you ping the VPN peer (its tunnel address)? –  Hauke Laging Apr 29 at 21:00
1  
Just a note, I guess if the OP were aware of these tools and how to use them, he won't be here, asking for help. –  0xAF Apr 29 at 21:55
    
@0xAF I hope you don't want to indicate that everyone who knows that ip addr, ip route, and iptables -L -nv produce output useful for debugging was "aware of how to use these tools"... –  Hauke Laging Apr 30 at 0:28
2  
@azaquiel, checkout the contents in /etc/resolv.conf (with root) and replace (or add) the "nameserver" line. To read something like this nameserver 8.8.8.8 (or any other DNS server IP address in place of 8.8.8.8). –  0xAF Apr 30 at 10:01

1 Answer 1

Your box needs to identify the default gateway as eth0, instead of tap0. Try changing the default settings through:

sudo route add default gateway dev eth0
share|improve this answer

Your Answer

 
discard

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.