2

I'm using Ubuntu 12.04 LTS. I use a VPN for work. In network manager, for both my normal wired connection, and for the VPN connection also, I have it configured to "Automatic (VPN) addresses only" and I specify the nameservers I want to use. But when I view /etc/resolv.conf after connecting to the VPN, it shows different nameservers. Even after disconnecting from the VPN, it's using those nameservers that I did not specify.

The problem is this causes a large delay in browsing the web because the VPN nameservers are either really slow or maybe it's timing out.

How can I get it to stick to using the nameservers I specify?

If I edit resolv.conf and set it to the nameservers I want, the delay goes away, so I know this is the problem. But every time I use connect to the VPN, it just overwrites it again.

2 Answers 2

1

IMPORTANT NOTE:

Starting from Ubuntu 12.04, some changes has been introduced into DNS resolving. It was announced here (Do read the VPN part). Also see its man page. Changes state that

resolvconf is a set of script and hooks managing DNS resolution. The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf. Instead, resolvconf uses DHCP client hooks, a Network Manager plugin and /etc/network/interfaces to generate a list of nameservers and domain to put in /etc/resolv.conf.

You can refer to this answer on Ask Ubuntu.

5
  • I'm reading through all that and trying various things but it still is automatically injecting 2 nameservers in resolv.conf whenever I connect to the VPN. I gave up and just made /etc/resolv.conf a regular file.
    – mentics
    Jul 6, 2012 at 11:19
  • If you want to add more entries to /etc/resolv.conf, create a /etc/resolvconf/resolv.conf.d/tail and add them there, BUT If /etc/resolv.conf contains 127.0.0.1, then adding entries to /etc/resolvconf/resolv.conf.d/tail won't really do anything useful. You should instead set the list of DNS servers statically in Network Manager which will then be configured in dnsmasq (that's running on 127.0.0.1).
    – atenz
    Jul 6, 2012 at 11:27
  • 127.0.0.1 does show up. As I explained in my question, I did specify static DNS servers in Network Manager. But it appears to be ignoring them.
    – mentics
    Jul 8, 2012 at 6:47
  • I would really suggest asking this question in Ask Ubuntu .I believe you will get better answer there , since Ubuntu related. Please unaccept this answer , since it doesn't solves your problem. Thank you.
    – atenz
    Jul 8, 2012 at 7:39
  • Your answer led me to a solution, so I'll leave it accepted. Your reference to the question on Ask Ubuntu has very useful information.
    – mentics
    Jul 9, 2012 at 17:54
1

Set resolv.conf to be immutable with chattr.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .