Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I connect to an Openvpn server that requires me to set up the tap interface with dhclient after establishing the connection.

I run and exit dhclient like this:

/sbin/dhclient -nw -v tap0 
/sbin/dhclient -r

My problem is that name resolution ceases to work after stopping the tunnel.

The problem relates to dnsmasq and resolvconf. I have read man pages and blogs, but am unable to fully grasp how these components work together or how to solve my problem, so I will list what I know and hope that someone can help me from there.

  • On running dhclient, the name server of the remote network gets added to /etc/resolv.conf. It seems that this is done through by the /etc/dhcp/dhclient-enter-hooks.d/resolvconf script, which adds a resolvconf record, which in turn results in the change in /etc/resolv.conf. The content of the resolv.conf is like this

    nameserver ip of nameserver on remote lan

    nameserver 127.0.1.1

    search search-domains from the remote lan + my normal search domain

  • On exiting dhclient the enter-hook script seems to run again, however, /etc/resolv.conf does not get updated.

  • I am not sure if the resolvconf record gets deleted or not. Is there any way to check this?

  • /run/nm-dns-dnsmasq.conf is always empty. Not sure if this means anything.

  • I am assuming that the fact that resolv.conf does not get updated is the reason that name resolution does not work. However, I am not sure how dnsmasq works. I was under the impression that dnsmasq would somehow establish a split DNS so that queries related to the remote lan went to the remote lans name server and everything else to the "normal" name server.

share|improve this question

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.