Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
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
Please accept the answer if it suits your question. :) – denisvm Jul 22 '14 at 2:34

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

  • address=/local/ -- doesn't work.
  • address=/loc/ -- works.
share|improve this answer

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.

share|improve this answer
/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 Aug 28 '15 at 14:57

You must log in to answer this question.

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