Listing Domain Names Your Server Is Configured To Respond To
On a Red Hat EL5 server, the ethernet interfaces (IP addresses the box’ll respond to) are defined in files in /etc/sysconfig/network-scripts/. So…
cd /etc/sysconfig/network-scripts/
The IP addresses are nice in those ifcfg-eth* files, but I still haven’t memorized what they are for, especially on a host like the one I am working on. This server does a lot. Here is a one-liner to do nslookups on all those IPs:
for i in `ls ifcfg-e*`; do echo $i; cat $i | grep IP | cut -d '=' -f2 | nslookup | grep name | cut -d '=' -f2; done
Let me know in the comments if this does or does not work for you. I have not thought very long about this but am willing to update this post with your improvements.
Unrelated: please listen to Elvis Costello’s “Punch The Clock” album twenty times and thank me later.
Related: would love to see some more sys admin tricks on this blog. I’m not much of a sysadmin and I’d love to learn.