I'd like to get .local addresses (such as test.local) to point to but it isn't working. I'm on latest Ubuntu. In /etc/NetworkManager/NetworkManager.conf I commented out dns=dnsmasq then did sudo service network-manager restart.

I then installed dnsmasq and added a address=/local/ to /etc/dnsmasq.d/mycustomfile then did sudo service dnsmasq restart. Apart from what I've mentioned I made no other changes.

But when I visit test.local it doesn't resolve to, doing a ping of that .local address also isn't successful. Maybe the contents of /etc/resolv.conf are relevant, it is just the default I didn't change it:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

This is the output when I run dnsmasq not as a daemon:

$ sudo dnsmasq --no-daemon     
dnsmasq: started, version 2.68 cachesize 150
dnsmasq: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth
dnsmasq: reading /etc/resolv.conf
dnsmasq: using nameserver
dnsmasq: using nameserver
dnsmasq: read /etc/hosts - 9 addresses

When dnsmasq is running the /etc/resolv.conf automatically updates (and reverts back to the entry above when dnsmasq is stopped):

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

And this:

$ sudo nslookup test.local

Name:   test.local

But still doing a ping to localhost doesn't work.

What do I need to do to get dnsmasq working to resolve .local addresses?


local seem to be some kind of reserved keyword, at least on Ubuntu:

  • address=/local/ -- doesn't work.
  • address=/loc/ -- works.
  • rand'Chris: Thank you for trying to improve an answer on Super User. But, while many people believe that it’s OK to correct errors in other people’s posts, and add small clarifications, your suggested edit is so substantial that (IMHO) it should be posted as a separate answer. It’s OK to repeat (some) information from a previous answer as long as you add something of value. (You should of course identify the answer that you are building on, by linking to it and citing the author’s name.) You might also want to refer to this other rejected edit. – Scott Sep 24 '18 at 22:35

Looks like dnsmasq is starting correctly. You should test if dnsmasq is correctly working with nslookup test.local

To make sure the system is using dnsmasq, you have to update the /etc/resolv.conf to use nameserver as first option.

You can also use a custo upstream resolver configuration on dnsmasq with --resolv-file=/etc/resolv.conf.dnsmasq.

  • I have updated my question with some information based on your answer, I'd appreciate if you could take a look. – user779159 Jul 21 '14 at 16:17
  • Also the original /etc/dnsmasq.conf file is left as it was originally, with everything commented out. Are there things I need to uncomment from there? (It's a large file over 600 lines.) The only thing I uncommented was the last line conf-dir=/etc/dnsmasq.d because my custom config file is under that directory. – user779159 Jul 21 '14 at 16:21
  • Your dnsmasq is responding correctly. The conf-dir directive does load all files inside the directory, so you can have organize in different files, not necessary needed in your case. You can keep the original dnsmasq.conf as it is and put your configuration in a custom file in /etc/dnsmasq.d, as you've already done. You don't need sudo to run nslookup. Test again with nslookup test.local, it will use the DNS configuration from /etc/resolv.conf this time. – denisvm Jul 21 '14 at 17:04

Probably the avahi-daemon is using the domain "local". See:


  • Welcome to Super User! Thanks for your contribution. Providing the link for reference is useful, but you must also include the essential information in the post. Please edit your answer so it contains that information. You might also like to take the Tour and read the How to Answer page, to better familiarise yourself with this site. – robinCTS Jun 23 '18 at 15:09

If what you want only involves pointing back at your own machine, and not trying to use dnsmasq to control other computers' dns resolving, then what you want is to actually just add some entries in /etc/hosts. I'd recommenced you undo all your changes to dnsmasq and it's settings and make sure that /etc/hosts has the following at the top: localhost mycomputername mycomputername.local anothername.local

After this, pinging mycomputername.local will point to yourself (actually, will point to dnsmasq server running on, THEN to localhost). You can even add entries for other computers on your network so that it appears to you, on this machine, that computers can be referenced as computer1.local computer2.local etc. computer1.local computer2.local

If you can't seem to undo your changes with dnsmasq, then you can add those additional entries after localhost, but do not delete or change the localhost entry itself. So like this: localhost mycomputername mycomputername.local anothername.local

BTW: the proper way to modify resolv.conf on Ubuntu desktop is with the network manager in your taskbar. The proper way in Ubuntu server is add dns-nameserver entries under your network device in /etc/network/interfaces and either restart or do ifdown eth0 && ifup eth0. As the warning in /etc/resolv.conf states, don't modify it directly, it gets written dynamically based on /etc/network/interfaces settings.

  • 3
    /etc/hosts does not allow wildcards, you'd have to update it for every new .local domain, that's why people use dnsmasq even for local resolving. – Dmitri Pisarev Aug 28 '15 at 14:57

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.