0% found this document useful (0 votes)
41 views

Installing Bind in Ubuntu

This document provides instructions for installing and configuring Bind DNS server in Ubuntu. It describes installing Bind using apt-get, then editing configuration files such as named.conf.local to define zones for domains and reverse DNS. It also covers creating zone files for the domains and reverse DNS, modifying options like forwarders, and testing the DNS server by changing resolv.conf and using dig.

Uploaded by

dnes9999
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Installing Bind in Ubuntu

This document provides instructions for installing and configuring Bind DNS server in Ubuntu. It describes installing Bind using apt-get, then editing configuration files such as named.conf.local to define zones for domains and reverse DNS. It also covers creating zone files for the domains and reverse DNS, modifying options like forwarders, and testing the DNS server by changing resolv.conf and using dig.

Uploaded by

dnes9999
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 4

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 named.conf. However, Ubuntu
provides you with a pre-configured Bind, so we will edit named.conf.local file
sudo vi /etc/bind/named.conf.local
This is where we will insert our zones.If 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 named.conf.local file
# This is the zone definition. replace example.com with your domain name
zone “example.com” {
type master;
file “/etc/bind/zones/example.com.db”;
};
# 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 “0.168.192.in-addr.arpa” {
type master;
file “/etc/bind/zones/rev.0.168.192.in-addr.arpa”;
};
Now you need to edit the options file
sudo vi /etc/bind/named.conf.options
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
123.123.123.123;
};
add the zone definition files (replace example.com with your domain name
sudo mkdir /etc/bind/zones
sudo vi /etc/bind/zones/example.com.db
The zone definition file is where we will put all the addresses / machine names that our DNS server
will know.Example zone file as follows
// replace example.com with your domain name. do not forget the . after the domain name!
// Also, replace ns1 with the name of your DNS server
example.com. IN SOA ns1.example.com. admin.example.com. (
// 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
// example.com = domain name
example.com. IN NS ns1.example.com.
example.com. IN MX 10 mail.example.com.
// Replace the IP address with the right IP addresses.
www IN A 192.168.0.2
mta IN A 192.168.0.3
ns1 IN A 192.168.0.1
Create Reverse DNS Zone file
A normal DNS query would be of the form ‘what is the IP of host=www in domain=mydomain.com’.
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 IN-ADDR.ARPA. This
domain allows for all supported Internet IPv4 addresses (and now IPv6).
sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa
copy and paste the following sample file
//replace example.com with yoour domain name, ns1 with your DNS server name.
// The number before IN PTR example.com is the machine address of the DNS server. in my case, it’s
1, as my IP address is 192.168.0.1.
@ IN SOA ns1.example.com. admin.example.com. (
2007031001;
28800;
604800;
604800;
86400
)
IN NS ns1.example.com.
1 IN PTR example.com
Restart Bind server using the following command
sudo /etc/init.d/bind9 restart
Testing Your DNS Server
Modify the file resolv.conf with the following settings
sudo vi /etc/resolv.conf
Enter the following details save and exit the file
// replace example.com with your domain name, and 192.168.0.1 with the address of your new DNS
server.
search example.com
nameserver 192.168.0.1
Test your DNS Using the following command
dig example.com

Apache Setup:
vi /etc/apache2/apache2.conf
NameVirtualHost ip.address:port
cd /etc/apache2/sites-available/
vi sitename
<VirtualHost 67.207.131.28:80>
ServerName ubuntu-tutorials.com
ServerAlias www.ubuntu-tutorials.com
ServerAdmin [email protected]
DocumentRoot /var/www/ubuntu-tutorials.com/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/ubuntu-tutorials.com .

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

You might also like