Score:1

DNS: Exclude subdomain from wildcard record

bd flag

I would like to match all subdomains to return an A record (this works) but I would like to exclude one particular subdomain from resolving (not sending an A record at all).

*.example.com.        IN   A   127.0.0.1
exclude.example.com.  IN   A   [no IP at all]

I would like to configure this directly in bind and also in a plesk environment.

Score:1
bd flag

To exclude an A record of a wildcard subdomain it is possible to add a TXT record with the particular subdomain.

*.example.com.        IN   A   127.0.0.1
differ.example.com.   IN   A   192.168.0.1
exclude.example.com.  IN   TXT "Hello"

Then exclude.example.com does not resolve. And in this example differ.example.com resolves to another IP than the wildcard IP.

Keith Langmead avatar
us flag
Will it not? Not tried yet so you could be right, but there's nothing stopping you having a A record and a TXT record with the same name, so surely the wildcard would still be returned when requesting an address rather than a TXT record that's unrelated to providing address information?
Nikita Kipriyanov avatar
za flag
Yes. `*.example.com` is not the same name as `exclude.example.com`. If you query exclude.example.com DNS server notice there *is* a record with that name but with no A data, so it will return nothing in reply to A query. For other records, like include.example.com it will see there is no record with such name, so it will check wildcard.
Teddy avatar
bd flag
@KeithLangmead I was surprised it works that way. But at least on my own bind installation and also on a plesk installation (where I don't know the used DNS server) it works like this.
Keith Langmead avatar
us flag
@Teddy Nice. Tried it and can confirm it works on Windows DNS (on server 2019) as well.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.