Installing Bind in Ubuntu
sudo apt-get install bind9 dnsutils
This will install all the required packages for bind9
Configuring Bind
If you install Bind from the source code, you will have to edit the file [Link]. However, Ubuntu
provides you with a pre-configured Bind, so we will edit [Link] file
sudo vi /etc/bind/[Link]
This is where we will insert our [Link] you want to know what is zone in DNs check this
DNS zone is a portion of the global DNS namespace. This namespace is defined by RFC 1034,
“Domain Names - Concepts and Facilities” and RFC 1035, “”Domain Names - Implementation and
Specification”, and is laid out in a tree structure from right to left, such that divisions of the namespace
are performed by prepending a series of characters followed by period (‘.’), to the upper namespace
You need to add the following lines in [Link] file
# This is the zone definition. replace [Link] with your domain name
zone “[Link]” {
type master;
file “/etc/bind/zones/[Link]”;
};
# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse
notation - e.g my network address is 192.168.0
zone “[Link]” {
type master;
file “/etc/bind/zones/[Link]”;
};
Now you need to edit the options file
sudo vi /etc/bind/[Link]
We need to modify the forwarder. This is the DNS server to which your own DNS will forward the
requests he cannot process.
forwarders {
# Replace the address below with the address of your provider’s DNS server
[Link];
};
add the zone definition files (replace [Link] with your domain name
sudo mkdir /etc/bind/zones
sudo vi /etc/bind/zones/[Link]
The zone definition file is where we will put all the addresses / machine names that our DNS server
will [Link] zone file as follows
// replace [Link] with your domain name. do not forget the . after the domain name!
// Also, replace ns1 with the name of your DNS server
[Link]. IN SOA [Link]. [Link]. (
// Do not modify the following lines!
2007031001
28800
3600
604800
38400
)
// Replace the following line as necessary:
// ns1 = DNS Server name
// mail = mail server name
// [Link] = domain name
[Link]. IN NS [Link].
[Link]. IN MX 10 [Link].
// Replace the IP address with the right IP addresses.
www IN A [Link]
mta IN A [Link]
ns1 IN A [Link]
Create Reverse DNS Zone file
A normal DNS query would be of the form ‘what is the IP of host=www in domain=[Link]’.
There are times however when we want to be able to find out the name of the host whose IP address =
x.x.x.x. Sometimes this is required for diagnostic purposes more frequently these days it is used for
security purposes to trace a hacker or spammer, indeed many modern mailing systems use reverse
mapping to provide simple authentication using dual look-up, IP to name and name to IP.
In order to perform Reverse Mapping and to support normal recursive and Iterative (non-recursive)
queries the DNS designers defined a special (reserved) Domain Name called [Link]. This
domain allows for all supported Internet IPv4 addresses (and now IPv6).
sudo vi /etc/bind/zones/[Link]
copy and paste the following sample file
//replace [Link] with yoour domain name, ns1 with your DNS server name.
// The number before IN PTR [Link] is the machine address of the DNS server. in my case, it’s
1, as my IP address is [Link].
@ IN SOA [Link]. [Link]. (
2007031001;
28800;
604800;
604800;
86400
)
IN NS [Link].
1 IN PTR [Link]
Restart Bind server using the following command
sudo /etc/init.d/bind9 restart
Testing Your DNS Server
Modify the file [Link] with the following settings
sudo vi /etc/[Link]
Enter the following details save and exit the file
// replace [Link] with your domain name, and [Link] with the address of your new DNS
server.
search [Link]
nameserver [Link]
Test your DNS Using the following command
dig [Link]
Apache Setup:
vi /etc/apache2/[Link]
NameVirtualHost [Link]:port
cd /etc/apache2/sites-available/
vi sitename
<VirtualHost [Link]:80>
ServerName [Link]
ServerAlias [Link]
ServerAdmin [Link]@[Link]
DocumentRoot /var/www/[Link]/html
</VirtualHost>
What these settings do is as follows:
• ServerName listens for requests asking for a certain domain
• ServerAlias defines any additional domains that should match
• ServerAdmin is the contact for the site
• DocumentRoot is the path to the content for that site
Now that this file is created in the /etc/apache2/sites-available/ folder we’re just about ready to start,
but we need to enable it. We can do that by creating a symbolic link from one folder to the next.
cd /etc/apache2/sites-enabled/
ln -s ../sites-available/[Link] .
This site is now available (as in configured) and enabled (as in listening) once we restart the apache
service:
sudo /etc/init.d/apache2 restart