
Domain Name Systems (DNS) is a vital part of a web server, allowing the use of domain names to access the web server. If you want to learn of the technical details of DNS, you can read about it on Wikipedia. We will be installing and using the BIND DNS Server and Webmin to create our DNS records.
Setting Up Custom Name Servers
First of all, you should collect some information. You’ll need a domain to use for name servers (you don’t need a specific domain for this, a domain you already use will work), you’ll need to know your server’s primary IP address and one of the secondary IP addresses.
After you’ve collected that information, you’ll need to go to the registrar of your domain to register custom nameservers. The process of doing this greatly varies from registrar to registrar, some have it available in their online control panel, and others require you to email them to do it. Look at your registrar’s documentation or contact them if you’re unsure how to do this. Your primary name server should be ns1.yourdomain.com, primary name server IP should be your main server IP, secondary name server should be ns2.yourdomain.com and secondary name server IP should be one of your secondary IP addresses (replace yourdomain.com with the domain you’re going to use for your name servers – it doesn’t have to be a .com).
Install BIND
After you’ve setup your custom name servers with your domain registrar, you’re ready to install the BIND DNS Server on your server. SSH into your server and run the following command to install BIND (it may already be installed):
yum install bind
Setting Up DNS Records
Now, login to your Webmin panel. Expand the “Servers” link on the sidebar. Click on BIND DNS Server, if it isn’t there find it under “Un-used Modules” and enable it.
Now, under Existing DNS Zones, click on Create master zone. We’re going to setup a DNS record for our main domain and name servers. Replace yourdomain.com with the domain you used. Enter the following information into the textboxes:
- Domain name: yourdomain.com
- Master server: ns1.yourdoman.com
- Ensure Add NS record for master server? is checked
- Email address: Enter a “webmaster” email address here
Now, click the Create button. Click on the Name Server icon. ns1.yourdomain.com. should have already been created, so type ns2.yourdomain.com. (including the period at the end) into the Name server textbox and click Create.
Click Return to record types at the bottom of the page. Then click on the Address icon. Make the following records:
- Name: ns1 Address: Your primary IP address. Click Create
- Name: ns2 Address: The secondary IP address you used for your custom name servers. Click Create
- Name: www Address: Your primary IP address. Click Create
- Name: leave blank Address: Your primary IP address. Click Create
Click Return to record types at the bottom of the page. Then click on the Check Records button at the bottom of the screen. If no errors are reported, click on Apply Zone, then on Apply Configuration at the top-right of the screen.
You have now created custom name servers, installed BIND and added a DNS record for your name servers and domain. You can now start to point your other domains to your name servers. For each domain you host on your server, you will have to add a DNS record for it. Just follow the instruction above, however leave out the ns1 and ns2 records under Address. Don’t forget to add these domains to your Apache Virtual Host configuration.
Next week
At this point in the series, you should now have a fully-functional web server. Next week we’ll be securing our server by installing a software firewall, changing the SSH port, etc. So, you should (try to) refrain from using your server for hosting sites until then.





Minnesota Attorney
March 1, 2009 5:53 am
These instructional posts are a great set of tutorials. Thank you!