Mapping Any Domain Name in a Zone to a Single IP Address

2.18.1 Problem

You want to map every domain name in a zone to a single IP address.

2.18.2 Solution

Add an A record to the zone attached to the wildcard domain name. For example:

*.foo.example. IN A

2.18.3 Discussion

Technically, this record doesn't map every domain name in the zone to In fact, the wildcard domain name doesn't apply to domain names in the zone data file. Say you also had the domain name in the foo.example zone: IN A

The wildcard domain name wouldn't match queries for the address of, which is probably a good thing, since has a different address. The wildcard domain name wouldn't apply to domain names that own other types of records, either. For example, you might have this record in the zone: IN TXT "Text comment"

Queries for the address of would return an empty answer, because has no addresses.

So what does the wildcard domain name apply to? Queries for domain names in the zone that don't appear in the zone data file, which means any domain name you can think of that ends in foo.example, doesn't appear in the foo.example zone data file, and isn't part of a delegated subdomain of foo.example.

Wildcard domain names can own other types of records, too. Take, for example, this CNAME record:

*.foo.example. IN CNAME foo.example.

This creates aliases from any domain name in the zone without explicit records attachedto the domain name foo.example. So iif you leave out explicit records for, someone looking up would find that domain name is an alias for foo.example. Someone looking up would find that it, too, is an alias for foo.example -- assuming you didn't have any records attached to the domain name, that is. So you might think of a wildcard as a "default" domain name for a zone: any explicit domain name in the zone has only the records you give it, but the wildcard applies to every other domain name in the zone.

As the example suggests, wildcards can match more than one label. In fact, a wildcard matches zero or more labels. The wildcard domain name in the CNAME record wouldn't match just foo.example, though, since even at zero labels, *.foo.example has one more dot than foo.example.

2.18.4 See Also

"Wildcards" in Chapter 16 of DNS and BIND.

Getting Started

Zone Data

BIND Name Server Configuration

Electronic Mail

BIND Name Server Operations

Delegation and Registration


Interoperability and Upgrading

Resolvers and Programming

Logging and Troubleshooting


DNS & BIND Cookbook
DNS & BIND Cookbook
ISBN: 0596004109
EAN: 2147483647
Year: 2005
Pages: 220
Authors: Cricket Liu

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: