Retrieve all DNS zones (domains) from local server

Hello,

I am trying to retrieve all DNS zones from the local bind server without parsing the /var/named folder, removing .db from the zone file names and the special zones files. I am looking for some kind of named, dig etc command that would retrieve all domains from the server eventually with the corresponding site's IP (this is less important) like this (just the command and the params):

domain1 ip
domain2 ip
....

There are some 600 accounts and probably close to 1000 domains. There is cPanel installed on the server.

The final purpose is to have a list with all domains: active, moved, expired etc because we'll move them to a different server and we want a very precise list with all of them. I am a beginner with bash scripting.

Thanks and regards!

Some implementations of nslookup include an ls command to list all the entries in a domain

Take a look at:
nslookup MAN Page

and dare I mention this here if you have a windows machine pointed at this dNS server then look at:
Nslookup: ls

For the Unix version if it includes ls then you can script it using heretext, e.g.:

nslookup << EEOOFF
server <domain1>
ls
server <domain2>
ls
EEOOFF

I am not certain about the server <domain> bit as the method of changing which domain you are then listing, perhaps another member of unix.com can comment please?

HTH

I haven't dealt with webhosting on that level, but doesn't the dns entries get stored in /etc/hosts, /etc/resolv.conf, or something similar to that?

If you can get a list of IPs or FQDNs you can feed them into an nslookup, then grep/awk/sed what you wanted out of it and output it to a file.