In this post we’ll cover a quick and dirty guide on how to create a DNS server using Ubuntu 13.04 and bind9.
Firstly install your ubuntu with minimal settings.
Next install bind9
sudo apt-get install bind9
next we need to make the directories that we will be using. I like to keep it all tidy so i put my databases in a zone folder.
cd /etc/bind
mkdir zones
Now lets define our zone files.
Edit the file /etc/bind/named.conf.local
zone “domainname.com” {
type master;
file “/etc/bind/zones/example.com.db”;
};zone “1.1.10.in-addr.arpa” {
type master;
file “/etc/bind/zones/rev.1.1.10.inaddr.arpa”;
};
Now lets get our forwarder working.
Edit the file /etc/bind/named.conf.options
## Find this
forwarders {
0.0.0.0;
};## Replace with
### These are the DNS serves for virgin media UK
forwarders {
194.168.4.100; 194.168.8.100;
};
Check that the named.conf file is including the above 2 files.
root@dns:/etc/bind# cat named.conf
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.localinclude “/etc/bind/named.conf.options”;
include “/etc/bind/named.conf.local”;
include “/etc/bind/named.conf.default-zones”;
Now its time to make the actual files that contain the dns data. These are also known as the zone files. Make server that the you change the serial number up when you make changes if you plan to have replication. Use the date in yyyymmddhhmm as that will always go up. eg 201305231324
cd zones
sudo vi example.com.db$TTL 86400 ; 24 hours could have been written as 24h or 1d $ORIGIN example.com. @ 1D IN SOA ns1.example.com. hostmaster.example.com. ( 2002022401 ; serial 3H ; refresh 15 ; retry 1w ; expire 3h ; minimum ) IN NS ns1.example.com. ; in the domain IN NS ns2.smokeyjoe.com. ; external to domain IN MX 10 mail.another.com. ; external mail provider ; server host definitions ns1 IN A 192.168.0.1 ;name server definition www IN A 192.168.0.2 ;web server definition ftp IN CNAME www.example.com. ;ftp server definition ; non server domain hosts bill IN A 192.168.0.3 fred IN A 192.168.0.4save and exit
sudo vi rev.1.1.10.inaddr.arpa
$TTL 86400 ; 24 hours could have been written as 24h or 1d $ORIGIN 1.1.10.IN-ADDR.ARPA. @ 1D IN SOA ns1.example.com. admin.example.com. ( 2002022401 ; serial 3H ; refresh 15 ; retry 1w ; expire 3h ; minimum ) ; server host definitions 1 IN PTR ns1.example.com. 2 IN PTR www.example.com. ; non server domain hosts 3 IN PTR bill.example.com. 4 IN PTR fred.example.com.
If all goes well we can now start the service.
sudo /etc/init.d/bind9 restart
* Stopping domain name service… bind9
waiting for pid 2875 to die
…done.
* Starting domain name service… bind9
…done.
You can test that its working with a windows machine.
cmd
nslookup – <serverip>
hostname
If you get an answer back your working.
If not you need to trouble shoot.
I would start with “tail –f /var/log/syslog” then in another session restart bind.
This should either give you an indication on where to start looking for issues of if the client is to blame.