Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of domains being managed by a DNS server [closed]

Tags:

dns

We have a server running Ensim, an old Plesk-like tool that lets us behave as though we're a web host. Over the years we've slowly exited from the hosting business but we still have a few clients on our server. The server is also a DNS server, and I've discovered that we're providing DNS for old client's services that we're not even hosting anymore. Our goal is to shutdown the server, but first we need to notify customers of any impact it may have on them. One of the things that I've notices is that we still have DNS zone entries for a number of domains, but that doesn't necessarily mean that those domains are using our DNS server. It just means that we still have the records. This makes it very difficult to tell which entries are being used and which ones are just old, orphaned entries.

My question is, is there some sort of tool that can tell me which domains are using our DNS server? I see a lot of ways to type in a domain, and get the DNS server, but I need to go the other direction where I type in a DNS server and get the domains. Does anything like this exist?

like image 283
user2395784 Avatar asked Oct 22 '22 09:10

user2395784


1 Answers

If you have the full list of domain names that you are interested in, you can use a special batch mode of dig to list all of the nameservers for all of those domain names in one single query. From the man page of dig:

The [-f filename] option makes dig operate in batch mode by reading a list of lookup requests to process from the file filename. The file contains a number of queries, one per line. Each entry in the file should be organized in the same way they would be presented as queries to dig using the command-line interface.

Normally, you would use: dig ns microsoft.com to get the nameservers for microsoft at the linux command line. Since you want more than one, you create a file that contains the list of domain names, one per line. Let's say you create a file called domainlist that contains the following lines:

microsoft.com
yahoo.com
google.com

You can then use:

dig ns -f domainlist

to list the nameserver records for them all. I personally prefer this variation:

dig +noall +answer ns -f domainlist

because this provides a very short list of NS records, with no comments or other records that I'm not interested in. You can also check if the email records for your clients' domains are still delegated to your mail server by using the same method to look up the mx records:

dig +noall +answer mx -f domainlist

Happy hunting!

like image 123
Michael Krebs Avatar answered Oct 25 '22 18:10

Michael Krebs