Add

How to set up DNS server with BIND on Ubuntu


This tutorial is about setting up DNS on Ubuntu and is the result of lot of documentation, many tutorials and many attempts. Hope you’ll find it usefull.
For installing DNS service on a machine, first thing to do in installing BIND (Berkley Internet Name Daemon):

sudo apt-get install bind9

The next thing to do is to configure bind. Usualy, for this you have to edit named.conf, but in Ubuntu the configuration file for bine is named.conf.local:

sudo /etc/bind/named.conf.local

Now you have to add the zones:

zone “domain.com” {
type master;
file “/etc/bind/zones/domain.com.db”;
};

#reverse DNS. (reverse notation of your network address (NOT you IP!!!) example: if NA = 192.168.1.0 then reverse DNS is: 1.168.192 )
zone “1.168.192.in-addr.arpa” {
type master;
file “/etc/bind/zones/rev.1.168.192.in-addr.arpa”;
};

The next step is to modify the forwarders to point to your ISP (the DNS server to which your own DNS will forward the requests). For this you have to edit named.conf.options:

sudo gedit /etc/bind/named.conf.options

This is what you have to add (replace with approriate IP addresses of course. We assum here that my ISP’s DNS are: 111.111.111.111 and 222.222.222.22):

forwarders {
111.111.111.111;
222.222.222.222;
};

Now we have to add the zone definition file. In the definition file will be stored all the addresses that our DNS server will know. We olso have to create a folder where to keep the file:

sudo mkdir /etc/bind/zones
sudo gedit /etc/bind/zones/domain.com.db

This is how the definition file should look like:

domain.com. IN SOA ns1.domain.com. admin.domain.com. (
2006081401
28800
3600
604800
38400
)

domain.com. IN NS ns1.domain.com.
domain.com. IN MX 10 mta.domain.com.

www IN A 192.168.0.2
mta IN A 192.168.0.3
ns1 IN A 192.168.0.1

The file for reverse DNS zone:

sudo gedit /etc/bind/zones/rev.0.168.192.in-addr.arpa

The number colored in red is the IP address of the machine running DNS server (in this case is 1, because the IP address of the machine running DNS server is 192.168.0.1).

@ IN SOA ns1.domain.com. admin.domain.com. (
2006081401;
28800;
604800;
604800;
86400
)

IN NS ns1.domain.com.
1 IN PTR domain.com

Edit resolv.conf:

sudo gedt /etc/resolv.conf

Modify resolv.conf:

search domain.com
nameserver 192.168.0.1

Now you have to restart bind and test your DNS server.

sudo /etc/init.d/bind9 restart

dig domain.com
dig domain.com mx

1 Star2 Stars3 Stars4 Stars5 Stars (14 votes, average: 4.93 out of 5)
Loading ... Loading ...

No comments yet.

Respond

get in on the action.

* Required

Rumanian flagItalian flagEnglish flagGerman flagFrench flagSpanish flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagSwedish flagNorwegian flagSerbian flagSlovenian flagUkrainian flagTurkish flagHungarian flag
By N2H

Random Posts Recent Comments

  • admin Says:

    Amigo, Please formulate your question in english if you really need help! Cheers!...

  • Mauricio Gonçalves Says:

    Boa tarde, Amigo eu não consigo add novo user poderia me ajudar? ele fala que o comando não é ...

  • Flossy Says:

    Zubao0 That's really thinking out of the box. Thanks!...

  • Michael Esch Says:

    I used this tutorial to install Komodo Edit 6 on Ubuntu 10.10; I rate your tutorial 5/5 I hope that...

  • admin Says:

    @dan Am rulat aplicatii create in visual basic si in fox sub wine, deci cred ca nu ar trebui sa fie ...

  • dan Says:

    as dori sa imi spuneti daca un prg de conta sub visual basic ruleaza cu wine sub ubuntu intreb deo...

  • admin Says:

    Thank you all for your comments. As I was busy latelly, I haven't answer to your posts. I hope you u...

  • tcpdump Says:

    Hello, I also faced the error "It appears as though you do not have permission to view informatio...

  • Ali Says:

    awesome!!!...

  • Schedule Says:

    You you should make changes to the post subject Split and join files in Ubuntu with lxsplit | EtutsR...

Tag Cloud