Setup a Basic Recursive Caching DNS Server and Configure Zones for Domain - Part 4
Abstract: file "/var/log/bind9/query.log"# host web1.sales.me.com
At this point we are ready to query our DNS server for local and outside names and addresses. The following commands will return the IP address associated with the host web1:
# host web1.sales.me.com # host web1 # host www.web1Query DNS on Domain Host
How can we find out who is handling emails for sales.me.com? It’s easy to find out – just query the MX records for the domain:
# host -t mx sales.me.comQuery MX Record Of Domain
Likewise, let’s perform a reverse query. This will help us find out the name behind an IP address:
# host 192.168.0.28 # host 192.168.0.29DNS Reverse Query on IP Address
You can try the same operations for outside hosts:
# host -t mx linux.com # host 8.8.8.8Check Domain DNS Information
To verify that queries are indeed going through our DNS server, let’s enable logging:
# rndc querylog
And check the /var/log/messages file (in CentOS and openSUSE):
# host -t mx linux.com # host 8.8.8.8Verify DNS Queries in Log
To disable DNS logging, type again:
# rndc querylog
In Ubuntu, enabling logging will require adding the following independent block (same level as the options block) to /etc/bind/named.conf:
logging { channel query_log { file "/var/log/bind9/query.log"; severity dynamic; print-category yes; print-severity yes; print-time yes; }; category queries { query_log; }; };
Note that the log file must exist and be writable by named.
SummaryIn this article, we have explained how to set up a basic recursive, caching DNS server and how to configure zones for a domain.
The mystery of name to IP resolution (and vice versa) is not such anymore! To ensure the proper operation of your DNS server, don’t forget to allow the service in your firewall (port TCP 53) as explained in Part 8 of the LFCE series (「Setup an Iptables Firewall to Enable Remote Access to Services「) and other articles in this same site such as Firewall Essentials and Network Traffic Control Using FirewallD and Iptables.
We hope you have found this article helpful – don’t hesitate to let us know if you have questions or comments. We always enjoy hearing from our readers!
Become a Linux Certified System Administrator Pages: 1 2 3 4