How to get the CNAME for a domain?

Michelle Konzack linux4michelle at
Tue Jan 10 10:40:05 UTC 2017

Hello experts,

I do not want to querry the world, but only my own Name Server for CNAME
configured (or not).

Currently I am updating my web administration interface and I have  lost
over the time a script, which queried my Name Server for CNAMES.

E.g. if I have a physical server <> I  like  to
know, which CNAMEs (on MY Name Server) pointing to it as    IN CNAME

OK, I can grep the whole /etc/bind/master/ directory, but since my  Name
Server is responsable for several 1000 (sub)domains,  the  execution  of
the script takes ages!



LIST=`cd /etc/bind/master/ && find -type f |grep -v -E "(.conf|.signed|.private|.key)$" |sed 's|^\./||' |sort`

for FILE in ${LIST}
  RET=`cd /etc/bind/master/ && grep -E "IN CNAME.*${VSERVER}" ${FILE} |sed "s|\.[ \t]*IN CNAME.*||"`

  if [ -n "${RET}" ]
    echo "${RET}"

Note: If I do not the "cd /etc/bind/master/ &&",
      I exceed the maximum lenght of the commandline.

Any ideas how to do this better?

Thanks in avance

Michelle Konzack        ITSystems
GNU/Linux Developer     0033-6-61925193
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <>

More information about the bind-users mailing list