The simplest way to configure DNS is to have someone else do it. For that reason, you should consider using the RimuHosting DNS service or the free, reliable and easy to setup service offered by zonomi.com (a RimuHosting operated business).
However, if you really want to run the DNS server yourself, this HOWTO article may help get you on the right track. It describes how to configure BIND using the Webmin Control Panel.
BIND is the name of a DNS server.
Make sure you have two IP addresses. Your registrar will require you to enter two IP addresses. Ideally those IP addresses would be on different servers to improve redundancy (fault tolerance). But in practice a lot of people just provide two IP addresses set up to point to a single server.
In name server jargon a zone is similar to a domain name. For example, you have a zone for yourdomain.com. All sub-domains, for example www.yourdomain.com, ftp.yourdomain.com, etc, are all part of the yourdomain.com zone.
To setup a zone, go to your Webmin CP. Then Servers. Then Bind. If prompted to create a new named.conf file, choose the "Setup as an internet name server, but use Webmin's older root server information " option.
Did you get an error like The primary configuration file for BIND /var/named/chroot/etc/named.conf does not exist, or is not valid. Create it?
.
Then you need to update your webmin modules (via webmin).
Under Zone Defaults, consider setting the Time-to-Live setting to 30 minutes (the 'Refresh' value). That makes it a bit more convenient when you're setting things up. There is nothing so annoying as making a mistake in your set up, and then having your ISP cache that error for the next day.
A short TTL will direct your ISP to cache your DNS information for a shorter period. Causing it to consult your DNS server more frequently. If your setup is stable, leave the TTL setting at its default. That will lower the load placed on your server.
Leave the defaults for the other settings on this page.
In the following examples if something is quoted, don't enter the quotes on the form. If there is a period inside the quotes, then it is significant and you need to enter that. It indicates the name is absolute.
A 'zone' is basically a domain name (yourdomain.com). Domain names like www.yourdomain.com and mysql.yourdomain.com are in the 'yourdomain.com' zone.
To start your DNS setup, create a new Master Zone.
Domain name is your zone. e.g. "yourdomain.com". "Master Server" is the DNS server 'in charge' of DNS for the zone. Other DNS servers are 'slave' servers and will generally sync themselves up with the master server. Typically, you'd enter "ns1.yourdomain.com" for the "Master Server". Enter an email address. Perhaps set the "Default Time to Live" to a lower value.
Create an 'A' record (this sets the IP address for a domain). E.g. Enter a 'Name' of "yourdomain.com." (include the trailing period, without the quotes). Set your IP Address.
Create an 'NS' record this will be the Name Server for the domain. E.g. Enter a "Zone Name" of "yourdomain.com." (include the trailing period, without the quote). Set the "Name Server", for example to "ns1.yourdomain.com." Add another record for ns2.yourdomain.com. You will need to define ns1.yourdomain.com and ns2.yourdomain.com (via CNAME or 'A' Address records).
Create a Name Alias ('CN' record). This creates a "Name" that resolves to a different domain. For example enter a "Name" of "www". Or "www.yourdomain.com.". Enter a "Real Name" like "yourdomain.com."
First, create a mail.yourdomain.com 'A' Address. Then create a Mail Server ('MX') record. Use a "Name" of "yourdomain.com.". Set the 'Mail Server' field to mail.yourdomain.com. Set a priority. 1 will do. If you have multiple mail servers, the mail server lowest priority that is available is used).
Note: Webmin may refuse to set up "yourdomain.com.". If so, try using "mail.yourdomain.com.".
Go back to the Zone list. Hit Apply Changes.
Note: BIND (aka named) may not be running by default on your server. Make sure it
starts on server startup, by logging into your server and running this command: chkconfig --level 35 named on
Now, let's test your DNS setup. From your PC, run the nslookup command. Switch your server to your DNS server by
typing "server yourserveripaddress". Increase the amount of detail you see
by typing set debug
. Do a lookup on the names you entered.
"yourdomain.com", "www.yourdomain.com".
Check they return the right information. To check you mail server in
nslookup, type "set type=MX", followed by "yourdomain.com".
Ultimately you should end up with a zone file something like this:
$ttl 38400
yourdomain.com. IN SOA ns1.yourdomain.com. webmaster.yourdomain.com. (
1055026205
6H
1H
5D
20M )
yourdomain.com. IN A 1.2.3.4
mysql.yourdomain.com. IN A 1.2.3.4
www.yourdomain.com. IN CNAME yourdomain.com.
ns1.yourdomain.com. IN A 1.2.3.4
ns2.yourdomain.com. IN A 1.2.3.5
yourdomain.com. IN NS ns1.yourdomain.com.
yourdomain.com. IN NS ns2.yourdomain.com.
mail.yourdomain.com. IN MX 1 yourdomain.com.
At this point you've set up your DNS server, it's serving up the right address information. You're done, right?
Nope. The rest of the world needs to know what name server to use for your domain.
So... You must pass on your name server information to your domain registrar. They are the people from whom you originally purchased your domain. Popular registrars include GoDaddy and Network Solutions.
If you are running your own DNS server (for example, following this howto) then you will probably use ns1.yourdomain.com and ns2.yourdomain.com as your name servers. If you are using third party name servers, for example, RimuHosting's then you will need to use something like ns1.rimuhosting.com and ns2.rimuhosting.com.
If you are using a different domain name for your name server than the zone it is serving, for example ns1.rimuhosting.com as the name server for yourdomain.com, then you can skip this section.
If you are using ns1/ns2.yourdomain.com as the name servers for yourdomain.com then you hit a catch-22. How can someone lookup the IP for yourdomain.com when the name server is ns1.yourdomain.com? To do that they need the IP for ns1.yourdomain.com. And to get that they need your nameservers. It is a vicious circle.
To get around the catch-22, you need to have your domain registrar publish the IP of each of your yourdomain.com name servers. This process is often called 'registering a name server' or 'creating a host record'. Unfortunately each domain registrar seems to use their own terms for the process. Typically the domain registrar will have the functionality under a link like 'Name Server Registration' or 'Setup Host Server' page. If you can't find it, ask your registrar for details.
For example, on GoDaddy.com you can set the name servers by going to: Domain Control Center -> yourdomain.com -> Domain Details -> Domain Host Information. (If you are using a different registrar, and discover their process for registering name servers then please let us know so we can provide the information for other users).
For example, at ev1servers.net: Click on the Name Servers link (on the left hand navigation panel under Manage Domains heading). Down the bottom of the page click on the "If you want to create or modify a nameserver which is based on yourdomain.com" link. That should take you to this page.
If you are not able to determine how to set your host server records at your particular domain registrar, send them an email worded something like:
"I need to register a name server. Please setup the following host records for yourdomain.com: ns1.yourdomain.com 206.123.122.xxx ; ns2.yourdomain.com 206.123.122.xxx. Then please set my name servers to ns1.yourdomain.com and ns2.yourdomain.com."
All done? Then get a report on your domain from pingability.com. This invaluable report provides a comprehensive PASS/FAIL/WARN checklist of DNS tests.