For about 2 hours I've been banging my head against a wall trying to get /etc/resolv.conf to use instead of

I've just finished grep -r on my entire partition and cannot find where this damn file is coming from. Whenever I restart the service it defaults back to

This is actually just to get a dnsmasq (running in docker) to be a pass-through DNS.

  • Read man resiolvconf – waltinator Oct 2 '18 at 15:58
  • If you're asking what I think you're asking then it appears to be compiled in to the systemd-resolved binary (specifically, the value of INADDR_DNS_STUB in the resolved-dns-stub.h file) – steeldriver Oct 2 '18 at 17:27
  • Is there any way to avoid INADDR_DNS_STUB? – MrMesees Oct 2 '18 at 19:28
  • Also @waltinator, I did. I could not find actionable information. If you know where there is for bionic 18.04, I'd love to hear about it. – MrMesees Oct 2 '18 at 19:29
  • @steeldriver Please see my answer. – heynnema Oct 2 '18 at 21:08

Looks like Ubuntu since 17.10 (possibly) now uses netplan by default to provide it's DNS source.

My Default Ubuntu (bionic) looks like this

# Let NetworkManager manage all devices on this system
  version: 2
  renderer: NetworkManager

This is why I later found NetworkManager through it's X/GTK frontend to be a suitable place to set the DNS (although I also did not know about nmcli). Apparently renderers supported so far are NetworkManager and networkd, although it's noted 1 that only NetworkManager supports WiFi.

I've yet to find a place to set this up so that it can work for all interfaces like the old method of editing /etc/resolv.conf, which doesn't work in vanilla 18.04 (maybe could, but it's a lot of work, I'm end-goal oriented).

  • networkd does support wireless interfaces, but it's much easier using NetworkManager. You should never manually edit /etc/resolv.conf. Use the GUI to set DNS servers. – heynnema Oct 18 '18 at 13:58
  • I'm not manually editing /etc/resolv.conf because it doesn't bloody well work in 18.04 vanilla. I've specifically stated I do exactly what you've advised me to do. Our difference of opinion is that I'm unhappy about needing to use a GUI to do that – MrMesees Oct 18 '18 at 16:07
  • 1
    See this post and look at tudor's answer for how to do it via cli. – heynnema Oct 18 '18 at 16:19

pre-note: never manually edit /etc/resolv.conf in /etc/resolv.conf comes from dnsmasq. in /etc/resolv.conf comes from systemd-resolved.

dnsmasq and systemd-resolved should normally not run at the same time... as they tend to step on each others toes.

If you want dnsmasq to run, you have to tell systemd-resolved to back off, like so...

sudo pico /etc/systemd/resolved.conf





Then reboot.

  • Hi, this is something I ran, however it did not resolve the issue, and in-fact crashed DNS. This is a vanilla bionic. Can you confirm this works on your machine? On mine it required two settings in order to free up port 53 DNSStubListener=no and DNSStubHandler=no It's got all updates installed on the system. – MrMesees Oct 2 '18 at 21:51
  • @MrMesees After changing DNSStubListener, did you reboot the system? I don't know about DNSStubHandler... where do you see that? Edit/update your question with ls -al /etc/resolv.conf. Report back to @heynnema – heynnema Oct 2 '18 at 22:10
  • I did. I also attempted restarting the service. Also I tried disabling the service before stop, then enabling and starting. – MrMesees Oct 2 '18 at 22:33
  • Please answer my ls question. Use @heynnema in comments to me, or I may miss them. Thanks. – heynnema Oct 2 '18 at 23:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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