Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old August 14th, 2006   #1
tomtom_in_eire
Spilled the Beans
 
tomtom_in_eire's Avatar
 
Join Date: Mar 2006
Location: Dublin, Ireland
Beans: 13
Ubuntu 6.06
Howto: Setup a DNS server with bind

After looking on Ubuntu forum for an easy step-by-step howto for instaling a DNS server, I decided the best idea would probably be to write this howto myself.... So, here it is!

Step 1: Install Ubuntu dapper, or use your WORKING installation.

Step2: Install bind 9:
Code:
sudo apt-get install bind9
Step 3: Configure the main Bind files. Usually, 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 another file:
Code:
sudo vi /etc/bind/named.conf.local
This is where we will insert our zones. By the way, a zone is a domain name that is referenced in the DNS server
Insert this in the named.conf.local file:
Code:
# 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";
};
Ok, now, let's edit the options file:
Code:
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.
Code:
forwarders {
      # Replace the address below with the address of your provider's DNS server
      123.123.123.123;
};
Now, let's add the zone definition files (replace example.com with your domain name:
Code:
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. You can take the following example:
Code:
// 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!
                                                        2006081401
                                                        28800
                                                        3600
                                                        604800
                                                        38400
 )

// Replace the following line as necessary:
// ns1 = DNS Server name
// mta = mail server name
// example.com = domain name
example.com.      IN      NS              ns1.example.com.
example.com.      IN      MX     10       mta.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
Now, let's create the reverse DNS zone file:
Code:
sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa
Copy and paste the following text, modify as needed:
Code:
//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. (
                        2006081401;
                        28800; 
                        604800;
                        604800;
                        86400 
)

                     IN    NS     ns1.example.com.
1                    IN    PTR    example.com
Ok, now you just need to restart bind:
Code:
sudo /etc/init.d/bind9 restart
We can now test the new DNS server...
Step 4: Modify the file resolv.conf with the following settings:
Code:
sudo vi /etc/resolv.conf
enter the following:
Code:
// 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
Now, test your DNS:
Code:
dig example.com
Look at the result.... Enjoy!
Also, this post is not perfect... Do not hesitate to improve it!
__________________
--------------------------
Canard Pimpant

Last edited by tomtom_in_eire; August 15th, 2006 at 03:38 AM..
tomtom_in_eire is offline   Reply With Quote
Old August 31st, 2006   #2
larka06
5 Cups of Ubuntu
 
Join Date: Aug 2006
Beans: 33
Re: Howto: Setup a DNS server with bind

I have setup my hp xg833, 733mhz and 384megs ram, just as you have above. I have even cut and pasted through putty. I have then set one of my other machines to go to the dns server to only have it say not able to reach the website I want to reach. Basically I am using the dns server for the intranet and the internet. I thought that once it did not find what I was looking for on the intranet it would go to the ISP, which I have set the ip addresses and host, on to the internet. Is this thinking correct? I am stumped.
Thanks larka06
email at larka51@netscape.net
I also can meet you on the IRC channel or anywhere you want me to be
larka06 is offline   Reply With Quote
Old September 13th, 2006   #3
hogman23
5 Cups of Ubuntu
 
hogman23's Avatar
 
Join Date: Jul 2006
Location: Jackson, MS
Beans: 37
Gutsy Gibbon Testing
Re: Howto: Setup a DNS server with bind

One more step to get it to work:
You must rename the named.conf.local to named.conf
hogman23 is offline   Reply With Quote
Old September 18th, 2006   #4
mekas2024
5 Cups of Ubuntu
 
Join Date: Jun 2006
Beans: 37
Re: Howto: Setup a DNS server with bind

Nice tutorial , i was working with this and with a tutorial that is in this page http://www.aboutdebian.com/dns.htm

The thing its that im not sure if a did everything well, i dont know how to test this..

y dig mekas.com and this says the terminal:

dantec@ubuntu:~$ dig mekas.com

; <<>> DiG 9.3.2 <<>> mekas.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 9469
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;mekas.com. IN A

;; Query time: 12 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Sep 18 00:42:30 2006
;; MSG SIZE rcvd: 27



if i dig something wrong, i get this:

dantec@ubuntu:~$ dig tadeo.meks.com

; <<>> DiG 9.3.2 <<>> tadeo.meks.com
;; global options: printcmd
;; connection timed out; no servers could be reached


I think its working, but i need to be sure, please i will apreciate if u help me, im kind of newbie in linux and i need to mount a dns server 4 a class ;)

THX a lot

Regards

MeKaS
mekas2024 is offline   Reply With Quote
Old September 20th, 2006   #5
subscr
First Cup of Ubuntu
 
Join Date: Aug 2006
Beans: 3
Re: Howto: Setup a DNS server with bind

When I try and install bnd9, here is what I get..Any ideas ?

sudo apt-get install bind9
Reading package lists... Done
Building dependency tree... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

Since you only requested a single operation it is extremely likely that
the package is simply not installable and a bug report against
that package should be filed.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
bind9: Depends: libdns21 (= 1:9.3.2-2ubuntu1) but 1:9.3.2-2ubuntu1.1 is to be installed
Depends: libisccfg1 (= 1:9.3.2-2ubuntu1) but 1:9.3.2-2ubuntu1.1 is to be installed
Depends: libisc11 (= 1:9.3.2-2ubuntu1) but 1:9.3.2-2ubuntu1.1 is to be installed
Depends: libisccc0 (= 1:9.3.2-2ubuntu1) but 1:9.3.2-2ubuntu1.1 is to be installed
subscr is offline   Reply With Quote
Old September 30th, 2006   #6
mitjab
Way Too Much Ubuntu
 
mitjab's Avatar
 
Join Date: Mar 2006
Location: Slovenija
Beans: 257
Ubuntu 8.04 Hardy Heron
Send a message via MSN to mitjab
Re: Howto: Setup a DNS server with bind

must domain be registered or not?
Can i use no-ip.com domain?

I am using router so which port must o foward for bind server?

www IN A 192.168.1.5
mta IN A 192.168.1.5
ns1 IN A 192.168.1.5

can i use for all three the same ip and the same machine?
__________________
Juventus the champion
mitjab is offline   Reply With Quote
Old October 21st, 2006   #7
garbergs
First Cup of Ubuntu
 
garbergs's Avatar
 
Join Date: Oct 2006
Location: Sweden
Beans: 12
Ubuntu 5.10
Re: Howto: Setup a DNS server with bind

I also had trouble installing bind9, so I tried to write:

apt-get install bind

and that gave me version 8.4.6-1. I'm sure this will suffice for my simple home network.
garbergs is offline   Reply With Quote
Old November 7th, 2006   #8
Bretls
5 Cups of Ubuntu
 
Bretls's Avatar
 
Join Date: Feb 2006
Beans: 20
Ubuntu 7.10 Gutsy Gibbon
Send a message via MSN to Bretls
Re: Howto: Setup a DNS server with bind

Thanks for the tutorial. I have a dynu account and used this as my domain name. I believe dynu is similar to no-ip.com. I installed bind9 with synaptic in edgy, and followed your directions. Works without a problem.
Bretls is offline   Reply With Quote
Old November 8th, 2006   #9
jaywatkins
Just Give Me the Beans!
 
jaywatkins's Avatar
 
Join Date: Dec 2005
Location: Philly PA, USA
Beans: 80
Ubuntu 7.10 Gutsy Gibbon
Re: Howto: Setup a DNS server with bind

Does this work for Edgy?

I would like to set up a "chrooted" bind server for local traffic and Internet forwarding. Would this tutorial work?

I was trying to follow on howtoforge.com regarding "A perfect setup" for Edgy 6.10 server, but ran into trouble when I came to setting up bind9. I understand DNS, just not bind.

Thx

/J
__________________
I'm tryin...
jaywatkins is offline   Reply With Quote
Old November 12th, 2006   #10
marwell
First Cup of Ubuntu
 
Join Date: Nov 2006
Location: Prague
Beans: 1
Kubuntu 6.06 Dapper
Smile Re: Howto: Setup a DNS server with bind

Finaly, what I was looking for.
Thanks a lot.
marwell is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:30 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry