Thursday, October 4, 2012

dns configuration in ubuntu


DNS (Domain naming system);
In the world of internet a human cant memorize each and every ip address of the websites, so the ip address of the site is resloved by the name so that the humans can memorize easily. For this purpose the dns is used it will resolve the website with ipaddress and viceversa. How to configure dns in ubuntu is shown below
my dns server ipaddress is 192.168.1.35 with the hostname ubuntu111
other system connected in lan are 192.168.1.34 with hostname ubuntu100
and other with ipaddress 192.168.1.28 with hostname venky
here I will reslove a fully qualified domain I.e; ubuntu111.team.com
for this we have to give the static ip for the server

#vim /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.35
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1
broadcast 192.168.1.255
:wq!

Here also set hostname
#vim /etc/hostname
ubuntu111
:wq!

And also set hosts file
#vim /etc/hosts
192.168.1.35 ubuntu111.team.com ubuntu111
:wq!


then go to dns of your system
#vim /etc/reslov.conf
search team.com.
nameserver 192.168.1.35  #(it is the dns server ip address in which you are creating)#

Then install bind package
#apt-get install bind9 dnsutils

here we will edit two files /etc/bind/named.conf.options & /etc/bind/named.conf.local

#vim /etc/bind/named.conf.options

forwaders {
192.168.1.1; #(this is gateway of your router)
123.176.37.37; (this is the default of your dns server provided by internet seen in reslov.conf)
123.176.37.35;
8.8.8.8;
8.8.4.4;
};

save and quit

#vim /etc/bind/named.conf.local
zone "team.com"
{
type master;
file "/etc/bind/zones/team.com.db";
};
zone "1.168.192.in-addr.arpa"
{
type master;
file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";
};

save and quit

here we will create a directory named zone in bind
#mkdir /etc/bind/zones
#vim /etc/bind/zones/team.com.db

#vim /etc/bind/zones/ rev.1.168.192.in-addr.arpa

then we will restart the bind service
#/etc/init.d/bind9 restart

to check the dns is working or not type
#dig ubuntu111.team.com

#nslookup ubuntu111.team.com
#nslookup ubuntu100.team.com
#nslookup venky.team.com
here he have created the dns server successfully

No comments:

Post a Comment