7

I used to be able to make foo.localhost, bar.localhost, etc. resolve to 127.0.0.1 by adding

address=/localhost/127.0.0.1

to /etc/dnsmasq.conf

But dnsmasq.conf doesn't exist in Ubuntu 14.04, and just creating it and adding the line doesn't work. Creating /etc/dnsmasq.d/star-dot-localhost with the line doesn't work either. So how do I do wildcard DNS redirection in Ubuntu 14.04?

  • 1
    Do you have dnsmasq installed? – Danatela May 8 '14 at 3:05
  • Oh. I thought it was installed by default. Thanks! – Alex Henrie May 9 '14 at 3:39
6

As @Danatela mentioned, you need to have dnsmasq installed in order for that approach to work. You can check if it is installed using apt-cache policy command:

$ apt-cache policy dnsmasq
dnsmasq:
  Installed: (none)
  Candidate: 2.68-1
  Version table:
     2.68-1 0
        500 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

Use these commands to install it:

sudo apt-get update
sudo apt-get install dnsmasq

Alternatively, you can edit your /etc/hosts file and add the following entries:

127.0.0.1    foo.localhost
127.0.0.1    bar.localhost
|improve this answer|||||
  • Is there any way to achieve the same result with "default" sw installed i.e. w/out dnsmasq? – lrkwz Feb 9 '16 at 8:42
  • Is it possible to create a dynamic host like if I enter xyz.localhost or pqr.localhost or etc.localhost then it will open the same? – Gomzy Sep 16 '19 at 7:12

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.