2

I use resolvconf for nameserver management because my OpenVPN requires it. However, I notice that it generates nameserver information that is not exactly how I would want it:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 173.31.45.181
nameserver 192.168.1.1
nameserver 8.8.8.8
search lan 8.8.8.8

Each directive here is undesired when I'm not connected to VPN, except nameserver 8.8.8.8. How do I know why resolvconf puts a particular entry? Is there a way of discerning i.e. what program wants nameserver 192.168.1.1 to be there? I tried man resolvconf but it doesn't provide the answer.

  • NetworkManager service automatically modifies your /etc/resolv.conf file. Disable this service and manually create the file. – fpmurphy Mar 30 '16 at 7:46
  • I use wicd and disabling it results in loss of connection. – Red Mar 30 '16 at 8:37
6

/etc/resolv.conf is built from pieces that are in the directory /run/resolvconf/interface (actual location on current Debian and Ubuntu) /etc/resolvconf/run/interface (old location, still existing via a symbolic link on Debian). Each piece is named after the interface that it is associated with.

When they aren't static, the entries in /etc/resolvconf/run/interface are normally set from static configuration in /etc/network/interfaces, from scripts executed from /etc/network/if-*.d, or by services that set up network connections such as NetworkManager, wicd or OpenVPN. For example, OpenVPN comes with a script /etc/openvpn/update-resolv-conf that is normally called by the OpenVPN client configuration.

  • /run/resolvconf/interface rather than /etc/resolvconf/run/interface on my system. – Mikel Mar 31 '16 at 1:06
  • @Mikel In jessie /etc/resolvconf/run is a symlink to /run/resolvconf (at least on a typical new or upgraded systems, there are a lot of special cases in resolvconf.preinst and resolvconf.postinst). Was the symlink dropped in stretch? – Gilles Mar 31 '16 at 1:16
  • Mine's Ubuntu 15.10 (wily). – Mikel Mar 31 '16 at 2:01
  • Definitely correct answer! However, I still can't see /etc/resolvconf/run/interface mentioned in a manpage you've linked to... – Red Mar 31 '16 at 6:24
  • @Red Indeed the man page doesn't mention the interface subdirectory. It isn't something that you should modify, but it can be useful to look there in situations like yours where you wonder where a line comes from. – Gilles Mar 31 '16 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.