Server Fault is a question and answer site for system and network administrators. 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'm trying to get wildcard DNS enabled on my laptop using dnsmasq. I realize that this has been asked and answered more than once on this forum, but I can't get the solution to work for me.

Steps taken so far:

  • Installed dnsmasq
  • Set address=/ in dnsmasq.conf
  • Set listen-address= in dnsmasq.conf
  • Ensured nameserver is in /etc/resolv.conf
  • Set prepend domain-name-servers; in /etc/dhcp3/dhclient.conf
  • Created a vhost for
  • Restarted apache and dnsmasq

Note: is not set in /etc/hosts

My vhost for

<VirtualHost *:80>
        DocumentRoot /home/jkendall/public_html/example/public
        ServerAlias *

        # This should be omitted in the production environment
        SetEnv APPLICATION_ENV development

        <Directory /home/jkendall/public_html/example/public>
                DirectoryIndex index.php
                AllowOverride All
                Order allow,deny
                Allow from all

The setup above will server locally without any problem. It will also serve, but returns the default apache "It works!" index.html from /var/www rather than my index.php in /home/jkendall/public_html/example/public.

The solution in this Server Fault thread suggests that


would resolve my problem, but when I try to use that solution, restarting dnsmasq results in a failure with the error message

dnsmasq: error at line 62 of /etc/dnsmasq.conf

For grins, I moved my project over to /var/www/example and modified the vhost appropriately. I got the same result as described above.

At this point I'm not sure what other steps I can take to resolve the issue. Thoughts?

share|improve this question
up vote 0 down vote accepted

It seems I've been laboring under a fundamental misunderstanding of dnsmasq, vhosts, and dns. dnsmasq was doing exactly what it was supposed to do, routing requests for to While I did have vhosts set up, and set up properly, there was no local DNS server to respond and direct those requests to the proper place.

What finally solved my problem was installing bind9, creating a zone for, and then adding an A record for the wildcard subdomain.

Here are the details:

  • Installed bind9 via Synaptic Package Manager
  • Added a zone to named.conf.local
  • Copied /etc/bind/db.local to /etc/bind/
  • Edited the new zone file appropriately for my needs.
  • Tested
  • Danced a victory dance

Here's my named.conf.local

zone "" {
    type master;
    file "/etc/bind/";

Heres my

; BIND data file for local loopback interface
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                       201005173       ; Serial
                        604800         ; Refresh
                         86400         ; Retry
                       2419200         ; Expire
                        604800 )       ; Negative Cache TTL
@       IN      NS      localhost.
@       IN      A     IN      A
*       IN      A
@       IN      AAAA    ::1

I will not be providing an example of the victory dance.

share|improve this answer

I have the exact same setup as you described in your question with one addition: In my Apache vhost Listen 80 and NameVirtualHost *:80 is set. This should connect the apache to port 80 - where you browser is listening and this might be the part, that your initial setup is missing.

If you can restore your initial setup (yes I know, it was 1/2 year ago) you also need to test, if dnsmasq is working properly by calling dig | grep SERVER (which should return ;; SERVER:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.