Unable to resolve DNS address when connected to OpenVPN serv

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
viffer
OpenVpn Newbie
Posts: 2
Joined: Tue Sep 10, 2013 8:34 pm

Unable to resolve DNS address when connected to OpenVPN serv

Post by viffer » Tue Sep 10, 2013 8:47 pm

Hi,

I've read many topics about this but no topic I found gave me the solution. I have a Ubuntu server running OpenVPN, this is the config file

Code: Select all

dev tun
proto tcp
port xxxx
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
user nobody
group nogroup
server 192.168.254.0 255.255.255.0
topology subnet
duplicate-cn
persist-key
persist-tun
status openvpn-status.log
verb 3
client-to-client
push "redirect-gateway def1"
log-append /var/log/openvpn
comp-lzo
I connect a windows 7 client using the following config file

Code: Select all

dev tun
client
proto tcp
remote x.x.x.x xxxx
resolv-retry infinite
nobind
# Try to preserve some state across restarts.
persist-key
persist-tun
ca "C:\\Program Files\\OpenVPN\\config\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\config\\client.crt"
key "C:\\Program Files\\OpenVPN\\config\\client.key"
comp-lzo
# Set log file verbosity.
verb 4
On the server the following iptables are set

Code: Select all

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  192.168.254.0/24     anywhere
Now I can connect to my VPN and also use the resources on the remote LAN. But I can't resolve any hostnames so it's impossible to surf to for example google. I can ping google's IP address (74.125.132.100) but when I try to ping google.com I don't even get an IP address.

Anyone an idea what might be wrong?

viffer
OpenVpn Newbie
Posts: 2
Joined: Tue Sep 10, 2013 8:34 pm

Re: Unable to resolve DNS address when connected to OpenVPN

Post by viffer » Wed Sep 11, 2013 3:20 pm

Don't ask me why, but something I've tried like 10 times works now; I added a line to my server configuration:

Code: Select all

push "dhcp-option DNS x.x.x.x"
and it works.

Post Reply