multiple local domains with dnsmasq?

John picture John · Jul 11, 2013 · Viewed 10.9k times · Source

So I'm using dnsmasq for my local dev environment & I need to set it up to use multiple domains ex. (.dev, .test, .somethingelse) how can this be done?

currently It's working with .dev only

this is how my dnsmasq.conf looks like

address=/dev/127.0.0.1
listen-address=127.0.0.1

Answer

mattes picture mattes · Sep 13, 2013

For every (sub)domain you want to server locally, add the following entry to your dnsmasq.conf:

address=/.domain/127.0.0.1

Now let your OS know, that you want to redirect requests to this domain to your local dnsmasq nameserver. Do this by creating a file "domain" in "/etc/resolvers".

/etc/resolvers/domain has the following content:

nameserver 127.0.0.1

More info about the resolver thing.