Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 152

Thread: Howto: Setup a DNS server with bind

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    Dublin, Ireland
    Beans
    13
    Distro
    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!
    Last edited by tomtom_in_eire; August 15th, 2006 at 08:38 AM.

  2. #2
    Join Date
    Aug 2006
    Beans
    40

    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

  3. #3
    Join Date
    Jul 2006
    Location
    Jackson, MS
    Beans
    37
    Distro
    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

  4. #4
    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

  5. #5
    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

  6. #6
    Join Date
    Mar 2006
    Location
    Slovenija
    Beans
    260
    Distro
    Ubuntu 8.04 Hardy Heron

    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

  7. #7
    Join Date
    May 2014
    Beans
    1

    Re: Howto: Setup a DNS server with bind

    Quote Originally Posted by subscr View Post
    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
    just simply
    remove all the libraries defined above by the apt-get remove command for example
    apt-get remove libisccfg1
    then simply install the bind9 by the apt-get install bind9 command

  8. #8
    Join Date
    Mar 2008
    Beans
    1

    Re: Howto: Setup a DNS server with bind

    Quote Originally Posted by mekas2024 View Post
    ; <<>> DiG 9.3.2 <<>> mekas.com
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 9469
    status: SERVFAIL says you have errors, check the syslog for details.
    I recommend to remove all comments (// lines) from the zone files

  9. #9
    Join Date
    Dec 2007
    Beans
    8
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Howto: Setup a DNS server with bind

    Hey, thanks for the tuts man, its working great... well kind of.

    The DNS its self IS working... but i want something like this to work, http://intranet/ ... ranther than http://xxx.intranet/ .

    I have tried changing example.com to intranet, but that doesnt quite work. I now have to do this: http://intranet./ for the PC to register http://intranet/ as a valid DNS destination.

    Anyone got this to work with a single domain entry ?

    EDIT:

    Huh, its amazing what a night can do. I guess the dns timed out, and required an update, because i tried my intranet url again this morning, and it now works! Thanks again for the tuts guys

    EDIT:

    Maybe not... spoke too soon...
    doesn't seem to like single domains, without extentions.
    Last edited by meeces2911; July 14th, 2009 at 10:49 AM. Reason: -snip-

  10. #10
    Join Date
    Feb 2007
    Beans
    21

    Re: Howto: Setup a DNS server with bind

    Quote Originally Posted by hogman23 View Post
    One more step to get it to work:
    You must rename the named.conf.local to named.conf
    I want to point out that this isn't correct. The default setup is for named.conf to include named.conf.local. There should be a line at the end of your named.conf which looks like this:

    Code:
    include "/etc/bind/named.conf.local";
    For my setup, I wanted to use BIND to divert all domains ending in ".dev" to a local IP, and to act as a cache for all other requests. This is a nice easy way to set up a local testing environment. Here's how my setup looks:

    named.conf.local:
    Code:
    zone "dev" {
      type master;
      file "/etc/bind/db.dev";
    };
    
    zone "1.168.192.in-addr.arpa" {
      type master;
      file "/etc/bind/db.192.168.1";
    };
    db.dev:
    Code:
    ;
    ; BIND data file for dev sites
    ;
    $TTL    604800
    @       IN      SOA     dev. root.dev. (
                                  1         ; Serial
                             604800         ; Refresh
                              86400         ; Retry
                            2419200         ; Expire
                             604800 )       ; Negative Cache TTL
    ;
    @       IN      NS      dev.
    @       IN      A       192.168.1.10
    *.dev.  14400   IN      A       192.168.1.10
    db.192.168.1:
    Code:
    ;
    ; BIND reverse data file for dev domains
    ;
    $TTL    604800
    @       IN      SOA     dev. root.dev. (
                                  1         ; Serial
                             604800         ; Refresh
                              86400         ; Retry
                            2419200         ; Expire
                             604800 )       ; Negative Cache TTL
    ;
    @       IN      NS      dev.
    10      IN      PTR     dev.
    In this example, 192.168.1.10 is the computer hosting the ".dev" sites. I'm not an expert in this, but my setup seems to be working well. I think it's unfortunate that the syntax of these files is so obscure, compared to Apache's easy-to-read config files.

Page 1 of 12 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •