Is there a way to query our internal DNS entries to discover all the CNAME entries that point to a particular server?
Edit: We're a Windows environment, Server 2003.
|
Is there a way to query our internal DNS entries to discover all the CNAME entries that point to a particular server? Edit: We're a Windows environment, Server 2003.
| ||||
|
feedback
|
|
You didn't specify what your environment is but if you're using Unix I think a combination of dig and grep should work. Also your nameserver needs to to be configured to allow zone transfers, the particulars of which will be implementation dependent.
Or if you're on Windows you could use nslookup:
This should output all of the records for the domain Or with this untested (but seemly correct looking) perl script:
A couple of points for completeness:
| ||||
|
feedback
|
|
The DNS protocol does not allow you to do that sort of "reverse" lookup. You'll need to go out of protocol, such as using the grep suggestions provided by kce. | |||
|
feedback
|
|
If you have access to your DNS configuration, it is rather trivial to discover this data. However, anyone can have a CNAME pointing to your server. You won't be able to trace these. As @wombie has pointed out you can't do a reverse lookup for CNAMES. There is no PTR equivalent for CNAMES, and even if there where it is likely only some records would exist. A quick check of a random selection of domains would show PTR records often don't point back to the A record. Likewise, doing reverse lookups of PTR records for random addresses often doesn't find the corresponding A record. EDIT: CNAMEs are not the only way to alias a system. DNS allows multiple A records to point the the same address. Functionally this is the same as adding a CNAME but the method is different. Same problems apply outside your domain. To search for the various A records you would search for the IP address(es) of the system in question. | ||||
|
feedback
|
| |||
|
feedback
|