2

I am switching between multiple projects recently. All running locally on the same IP but with different domains... actually it's always *.local (like foo.local, bar.local and so on). I could continue adding those to my /etc/hosts file but it's not very clean way.

That's why I thought of setting up dnsmasq.conf so I've ran (obviously as root):

echo "address=/local/172.17.0.1" >> /etc/dnsmasq.conf
service dnsmasq restart

Unfortunately it doesn't work. I mean when I run foo.local (exists in /etc/hosts) it's ok but foo2.local (not in hosts) it doesn't. What do I miss?

Tomasz Kapłoński
  • 1,320
  • 4
  • 24
  • 49

2 Answers2

0

address=/local/172.17.0.1 in dnsmasq.conf should resolve the subdomain *.local too.

Have you tried the following?

address=/.local/172.17.0.1
address=/#.local/172.17.0.1
address=/#local/172.17.0.1

Make sure that dnsmasq is restarted.

Vikram Hosakote
  • 3,528
  • 12
  • 23
0

I have a simple config for local domain .loc, please (1) do place it in your /etc/dnsmasq.d/, (2) modify domain names to your needs and (3) restart dnsmasq:

###################
# .loc DNS domain #
###################

auth-server=loc            # auth server for .loc
host-record=loc,127.0.1.1  # glue A record
#auth-zone=loc,127.0.1.0/24 # zone spec (with subnet -- wildcards not working)
auth-zone=loc/24           # zone spec (no subnet -- wildcards working)
address=/.loc/127.0.1.2    # wildcard record (*.loc => 127.0.1.2)
mx-host=loc                # MX record

####################################
# custom .loc DNS domain A records #
####################################

host-record=what.ever.loc,127.0.1.100

This config allows to mix wildcards and custom records (host-records) as required.

bubak
  • 1,464
  • 1
  • 13
  • 11