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 would like to configure a nameserver that will return the same IP address ("A" record) for any arbitrary host name. For example:


should all return the same IP address. Is there a way to do this with BIND? Or is there an alternative to BIND that can do this? Thanks.

share|improve this question
up vote 16 down vote accepted

With BIND, you need a fake root zone to do this. In named.conf, put the following:

zone "." {
    type master;
    file "/etc/bind/db.fakeroot";

Then, in that db.fakeroot file, you will need something like the following:

@ IN SOA ( 1 3h 1h 1w 1d )
  IN NS <ip>
* IN A <ip>

With that configuration, BIND will return the same IP address for all A queries.

share|improve this answer
Works fine, but the main domain doesn't get resolved ? Any ideeas ? eg : – opc0de Jan 7 '14 at 20:59

According to the dnsmasq man page


should do the trick.

share|improve this answer
Thanks! That was so simple. Dnsmasq is definitely easier to configure than BIND. – balexand Jun 8 '12 at 16:09
Do you know if there's also a way to use a wildcard with MX records in dnsmasq? – balexand Jun 14 '12 at 18:15
It looks like mx-host and mx-target will do this. – Gerald Combs Jun 14 '12 at 18:49
Do you know how? The use of wildcards with mx-host and mx-target is not documented in the man page and I can't get it to work. I've tried using similar notation to the address option(# sign). I've been able to get wildcards working with both A and MX using BIND using Oliver's suggestion, but I'd actually prefer to use dnsmasq. Thanks! – balexand Jun 15 '12 at 22:55

You can do wildcard matching in bind.

*        IN      A       a.b.c.d

This has to be defined in your named configuration file for the domain. Just be carefull if you need to define other A records for the domain.

share|improve this answer
What part of "all domains" did you miss? – ceejayoz Jun 8 '12 at 18:29

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.