Domain Name System – Configure DNS Server to Return Same IP for All Domains

binddomain-name-systemwildcard

I would like to configure a nameserver that will return the same IP address ("A" record) for any arbitrary host name. For example:

  • example.com
  • subdomain.example.com
  • someotherdomain.com
  • anyotherdomain.co.uk

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?

Best Answer

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 ns.domain.com. hostmaster.domain.com. ( 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.