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

It is possible to configure DNSMasq such that it returns a fixed IP address only for a request for that exact domain, and not for its subdomains? That is, I want it to return a fixed IP when resolving, but not,, etc.

share|improve this question,

The dnsmasq man page says:

Add A, AAAA and PTR records to the DNS. This adds one or more names to the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may appear in more than one host-record and therefore be assigned more than one address. Only the first address creates a PTR record linking the address to the name. This is the same rule as is used reading hosts-files. host-record options are considered to be read before host-files, so a name appearing there inhibits PTR-record creation if it appears in hosts-file also. Unlike hosts-files, names are not expanded, even when expand-hosts is in effect. Short and long names may appear in the same host-record, eg. --host-record=laptop,,,1234::100

share|improve this answer

Just add an entry for that specific domain in the hosts file on the server running DNSMasq

share|improve this answer
That doesn't work; DNSMasq returns the same fixed IP for all subdomains of the entered domain – Michael Mrozek Dec 22 '12 at 4:30

From the man page of dnsmasq (for --server, but also applies to --address):

More specific domains take precendence over less specific domains, so: --server=/ --server=/ will send queries for * to, except *, which will go to

So the only solution I can see is to instead add individual records for each of the subdomains necessary. Obviously not ideal, but is the best dnsmasq can provide at this time (that I can find).

share|improve this answer

How is your configuration file? dnsmasq will resolve only subdomains if your entry starts with dot .

Example: address=/

If you have it this way:


it will also resolve

$ host has address
share|improve this answer
Interesting point, but if your read the question carefully, this isn't what the OP was asking for. – jcharaoui May 30 at 18:38

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.