DNS Servers
If you ever thought of becoming an ISP, Then keep reading this book.
DNS is the mother of the Internet (Domain Name server). The DNS server is responsible for translating IP addresses into actual names. For example when you type in your web browser: (www.domainname.com)
Before a web browser can request a web page sitting on the web server at that domain, first the browser contacts the nearest DNS server to query an IP address that matches that name.
But how does it actually work?
To answer this question, it is much better setting it up than explaining how it works.
Setting up the DNS Server
Setting up the DNS server is quite simple. Most, if not all, Linux distributions come with Bind (Berkley Internet Name Daemon) version 8 or 9.
Most likely, it was installed during your Linux installation, but if not refer to software installation in this book to install it. I really recommend it to be installed during the initial Linux installation simply because named-bootconf.pl generates a serial number for it (known as secret).
To configure the DNS server the named.conf file is used
- /etc/named.conf
- Directories: /var/named
The named.conf file will point to /var/named in order to query each zone. Every time you create a zone, a file will be created in the /var/named directory.
Before you make any changes make a backup copy of this file:
# cp named.conf named.conf.original
# vi named.conf
// generated by named-bootconf.pl
// secret must be the same as in /etc/rndc.conf
key "key" {
algorithm hmac-md5;
secret
"c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
};
controls {
inet 127.0.0.1 allow { any; } keys { "key"; };
};
options {
pid-file "/var/run/named/named.pid";
directory "/var/named";
/*
* If there is a firewall between you and name servers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
zone "." {
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa" {
type master;
file "named.local";
};
Observe that by default there are only two zones. Do not modify these two zones. By the way you should do an ls to /var/named, see that currently it holds two files named.ca and named.local.
When creating zones, you can name it whatever you want; but be consistent so your work will be professional (normally you will be using your domain name).
Editing the named.conf file can be done in several ways: manually, pre-configured bash script or using utilities.
I think that it is time to introduce another powerful administration utility. This utility can be used for any Linux flavor. Again thanks to the open source movement this utility comes free with most Linux distributions.
|