Sign up ×
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.

I am using Network Manager on Ubuntu 12.10 to connect to an openvpn server. The connection works without problems. However, when I connect, I would like to change my default DNS server to a server on the vpn network. That way I can use domain names that are only defined on the vpn network. Is there a way I can make this automatic with Network Manager?

I can also change settings on the openvpn server if that is the way I need to go.


share|improve this question
This should be done on the server. See similar question. – Rajesh Nov 7 '12 at 16:24
That looks like it will do the trick. I will try it out. Thanks! – Daniel Nov 7 '12 at 16:34

3 Answers 3

While this is something that is usually done on the server as mentioned in the comments, there might be cases where you only want to use the VPN's DNS for queries inside of the VPN. In that case you'd probably want to run a lightweight DNS daemon on your system and instruct it where to send what query. If you are in several VPNs at once this is basically a must.

share|improve this answer
up vote 0 down vote accepted

As per Rajesh, adding an option to the server seemed the best way to go.
See this question for complete details

share|improve this answer
  1. As for the server configuration, OpenVPN server should issue smth like

push dhcp-option DNS XXX.XXX.XXX.XXX

push dhcp-option DOMAIN mylocaldomain.local

(see more details here). XXX.XXX.XXX.XXX is your DNS-server, mylocaldomain.local is your local domain. Can be easily found in OpenVPN client output (dhcp-option DNS ...,dhcp-option DOMAIN ...) when you start it on your local machine.

  1. OpenVPN client should update the resolv.conf (tested on 14.04)

$ sudo openvpn --config client.ovpn --up /etc/openvpn/update-resolv-conf --down /etc/openvpn/update-resolv-conf --script-security 2

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.