Setting up BIND on CentOS 5.

5
This is part of an x10hosting directed series of tutorials that I am writing. It continues the last post I wrote for this series. It could be used in practice, though it's stability or security can't be guaranteed if you have already configured BIND or haven't followed the previous tutorial. This is probably the longest of all the tutorials and almost absolutely the hardest, hence it's length. This tutorial will teach the Linux beginner to configure BIND DNS daemon to be able to answer requests for their domains names on their x10 VPS. At the end of the tutorial the user will have: • • • • Learned how to set configure a BIND server. Learned how to add domains, MX records, subdomains, etc. Been familiarized with the Linux directory structure and file system. Provided with lots of links for more information on everything that's being discussed :P

Also, this tutorial assumes that: 1. Have no prior experience with the Linux command line. 2. You have followed the tutorial located here. 3. You have registered a domain with x10hosting First I will start by briefly describing what BIND is. I guess it's best said quoting the project's home page: Originally Posted by BIND home page BIND is by far the most widely used DNS software on the Internet. It provides a robust and stable platform on top of which organizations can build distributed computing systems with the knowledge that those systems are fully compliant with published DNS standards. That being said, if you didn't understand half of that I will explain in a bit more simpler terms. BIND is a DNS server which allows your VPS to answer requests made to your domain name. It is used widely across the internet, and the last little bit means it's really good at what it does. If you didn't register your domain with x10 you will have to adapt this tutorial to your needs. I will write in notes where adaptation will be needed. For this tutorial, I will be using example.com as my FQDN, or domain name. I will also be using 192.168.1.100 as my VPS's IP. You can use and change the following files to meet your needs.

conf" [New File]" at the bottom. example. all that happens is when version requests are sent to BIND it will return "Nope. On Linux there are no drive letters (C:\. you will find a lot of stuff that you really don't need to know to get your VPS answering calls and it can turn out quite confusing. The Linux file system isn't built like windows. D:\. . you should reconsider editing this file.This is a version statement for a bit of security.".) instead.com. }.conf Code: sudo vim /etc/named.conf This should bring up a new file. First thing we'll have to do is to edit a couple files using vim. If you see anything on your screen. You should not have any problem if you've followed the last tutorial. . your root directory is just /. If you search google for this. But if I wanted to visit my domain. except a bunch of ~'s and something like: ""/etc/named. perhaps. or commonly known as named (pronounced "named". Here is more reading on this. we open up the file /etc/named. Each directive is terminated with '. This is to .This tells BIND where to look for configuration and other files.conf. version "Nope. it uses a back slash (/). I will show you a basic named." instead of the version.So we have our basic LAMP set up working and we know this because we visited our server's IP from a browser. You can skip this by scrolling down to the next paragraph. This is your main BIND configuration file. So the goal here is to keep it simple and explain everything. instead of using forward slashes (\) between directories. So. which stands for name daemon. directory "/var/named".conf file and explain it a bit in more detail after. or editing files as "C:\" if you're a windows user. and. etc. or "name-d"). it comes up as not found in the browser because my VPS isn't set up to answer requests for that domain.". I will briefly explain the file system structure here in order to lessen confusion. Here is the file: Code: options { directory "/var/named". /var/named. First file is named. Each section's directives are contained within '{' and '}'. We will leave it at the default. logged in as our privileged user (joe). version "Nope. options { . A good rule of thumb when working from the command line on your VPS is to think of the first / when you are changing directories.'.The directives passed in this section are the main options for BIND. answer any questions. We are going to set up a basic BIND configuration.

I will describe what we added to this does as I did above. Now we have the name servers that we want to use (ns1.avoid exploiting any potential weaknesses. I like to just name it as the domain to make life easier.example. our named. Now before we go adding in the configuration for our site we must register the name servers in the x10hosting client area. Good stuff. Note that this file will need to be in the /var/named directory. I will explain it more in parts and attach the exact file in it's completeness. }. Code: vim /var/named/example.com" .".1.This is the file name in which we will find our configuration for this domain. This must be an FQDN. Code: $TTL 86400 . I have wrote a tutorial on how to do this here.". zone "example. as it is a subdomain as well. . but you can name it anything you like. file "example.com" }.com For our example.com we'll want to have a file that looks like the one below. This is is the Time To Live statement.168. or whatever was specified above. this record stays alive for 24 . not a subdomain. Now we will add in our site's entry to this file.This tells that this is a master zone and everything is on this server. file "example.conf file should look like this: Code: options { directory "/var/named".100). type master. this includes your domain without the "www.com and ns2. zone "example. It tells DNS Caching servers how long this record should stay in the cache.com" in { . We can now insert the DNS record in the /var/named directory.This tells us the the zone we are answering for. This is how we're going to do it.com) pointing to our VPS's IP (192. The value following it is in seconds. really. When we're done. version "Nope.example.com" in { type master.

com. ns2.com.100 192. Next is: Code: @ IN SOA ns2.example.168. Serial 10800 .example. admin. You can read about both here. These are the two name servers you registered in this article. you must replace the @ with a period. ns1. IN NS nameserver1.com.168.. Expire 86400 .com" and "admin. respectively.com. ftp.1.example. IN example.example. Moving on. Retry 604800 . Refresh 3600 .com. Next Section Code: example.com.100 192. I'm not too sure why and nobody really is.example.tld. Domains and subdomains with dots after them are absolute domains (FQDN) and those without are relative (PQDN).com. meaning that if you have trouble understanding DNS not to fret as it really is the hardest part of this series and many people have lost sleep over configuring DNS.tld.com.example.example. These are one of your nameservers that you registered with x10hosting.100 192. You don't need to enter .).168.com.1. For the email.168.100 192. www. It is telling the internet that this is all IN the record for this site.hours. Basically all you need to know at this point is that you don't need to change the numbers you see (Serial.100 The above is just a list of domains that your VPS will answer to. Notice the periods after every domain and subdomain entry.1. They follow the syntax Code: domain.168. Refresh. ( 2010062801 . etc.example.1.1. IN IN IN IN IN IN A A A A A A 192.1. Minimum ) This is the Start of Authority record.com.example. What you can change is "ns2. and the administrator's (your) email. mail.com".com. IN NS NS ns1. ns2. Code: example.168.100 192.example.example.domain. You could also write this as: Code: $TTL 24h.. The "IN" just has to be there if this is a site's DNS record.com.

168.168.What we are adding. ns1. It will tell other mail servers where to send mail. The rest of it.1. mail. The others are for giving services their own subdomain.168. ftp.example.com.168.168. mail) and completeness (nameservers).168.100 192. testing.100 192.example.example.100 192.example. We will set ours to mail. and type ':x') and start the BIND service.100 192.com.example.com.com' to my DNS record I would simply just add them to the end of that section.com.example.1.100 192.100 192.com. www. so I will finish it in this reply.100 192. if I wanted to add 'info.com. or the mail record. www.) this is where you must add any other sub-domains that you wish to have.com.1. To do this we type: Code: service named start You should see something like the following: Code: Starting named: [ OK ] .com. ns2. For example. Code: example.example. I will note that in the part where you name your sub-domains (www. we can exit and save the file (press 'esc'.com for example. (ftp. There you are.What we already have.168.com' and 'testing.1.com configuration file complete and all the subdomains we want are added.com. pretty straightforward.100 IN A IN A Any other FQDNs that you wish to add should be done the same way we added example.example. like so: Code: .com to our DNS records. This last bit of code is the MX record.example.example. IN MX 10 mail.com.example.any of these except the FQDN.com.1. So now that we've got our example. info. .1. I had to wait for this to be approved. IN IN IN IN IN IN A A A A A A 192.com.1.168. etc.1. example. example.example.com.

please message me and let me know and I will make the necessary changes. That's all for this tutorial. You can try pressing the refresh button. If you find anything in error or false or have anything to add. it should start up just fine. you should see an Apache test page on your domain. If you followed this tutorial to the word. If you've followed the tutorials.If it says [FAILED] instead of [ OK ] it should give you a brief reason as to why it failed. or sites. or you could try flushing your DNS. . I will also post the links to those articles when I have written them. you can try a few things to see if it's your computer that is causing it. In my next I will go through the steps needed to configure Apache to start hosting your sites. If named has started up successfully you can now open your browser and type in your domain name. If nothing comes up.

Sign up to vote on this title
UsefulNot useful