+ Reply to Thread
Results 1 to 6 of 6

Thread: Setting up a DNS Server

  1. #1
    ConorP is offline Coder ConorP will become famous soon enough
    Join Date
    May 2007
    Location
    Dublin
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Setting up a DNS Server

    Part 1 of (god knows how many, I don't know why, but I shouldn't decide to do stuff like this at 1am)

    Crappy legal stuff: Copyright moi. Don't even consider holding me liable for anything that happens or doesn't happen by following this guide or anything else which might or might not happen when you are reading this howto.

    e.g. If you are so engrossed in this guide and sitting in a chair with wheels when you push back and crush your cat and hear a very loud noise then swivel around to investigate it and in the process knock over a glass of some beverage you were consuming onto a already overloaded power extension and start a small electrical fire which then quickly spreads onto the giant magazine collection you have and sets fire to various other things in your room and eventually leads to the burning down of your house. Don't say I didn't warn you.

    Also if you plan on publishing this somewhere else, it would be nice if you gave credit and left the entire article intact. So lets move onto the howto.

    Due to multi platform madness I won't go into how to install bind (named) but you would be looking at doing one of the following commands

    apt-get install bind9
    yum install bind
    rpm -ivh bind_package_name.rpm
    emerge bind (Taking a stab at gentoo, never used it before)
    ./configure && make && make install (as root)


    Depending on the package you've just installed, you could have a configuration that works mostly out of the box, or no configuration at all. I'll just assume you've got no configuration. You should be able to pick up later on.

    Add a user which will not be used for anything else. This is a security thing so if someone does break/crack your DNS server, the damage they can do is limited.

    You'll want to make a user now

    adduser -h /var/named -s /bin/false named

    The -h tells you where you want the home directory and the -s is what shell you want used for this account. We use /bin/false to stop anyone logging in.

    And in part 2 we'll look at editing named.conf

  2. #2
    blacknight's Avatar
    blacknight is offline Web Slave blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold blacknight is a splendid one to behold
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    7,906
    Thanks
    9
    Thanked 8 Times in 7 Posts

  3. #3
    Join Date
    Jul 2006
    Location
    Galway / Ennis
    Posts
    277
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i couldn't get bind working, but djb dns worked great. good guide to install here. DJBDNS Howto - The Planet Forums

  4. #4
    ConorP is offline Coder ConorP will become famous soon enough
    Join Date
    May 2007
    Location
    Dublin
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    named.conf - The file which holds it all together.

    You'll normally find named.conf to be in /etc so we'll start there

    Open up /etc/named.conf in your text editor of choice. (Personally I like nano, I'll use vim where nano isn't available)

    We have to define some important things here

    We'll set the options for named firstly

    Code:
    options {
    directory "/var/named"; //Tell named where to find everything
    allow-transfer { none; }; //Don't let anybody preform a zone transfer 
    allow-recursion { localhost; }; //We don't want to be an open dns server
    // Use your ISP's or run your own damnit
    version "DNS Server"; //Set the version reply, so if anyone is profiling the //network, it makes it harder for them
    };
    
    Now you have the basic config for a DNS server but its pretty useless at the moment! It doesn't know where to look for DNS queries or what zones it is serving, we'll tell it where to find other DNS servers

    Change directory so you are now in /var/named

    We're going to have to download a little file here from the people who run the root dns servers

    Run this to download that file:
    wget http://www.internic.net/zones/named.root

    You should now have a file called named.root in /var/named. Don't worry about keeping this up to date or anything, the last change was made in 2004

    Just to be sure set the permissions of that file:

    chown named:named named.root

    Now head back into editing /etc/named.conf

    Add this to the bottom of the configuration (outside of the options bracket)

    Code:
    zone "." {
    type hint;
    file "/var/named/named.root";
    };
    
    So you should now have a file looking like this

    Code:
    options {
    directory "/var/named"; //Tell named where to find everything
    allow-transfer { none; }; //Don't let anybody preform a zone transfer 
    allow-recursion { localhost; }; //We don't want to be an open dns server
    // Use your ISP's or run your own damnit
    version "DNS Server"; //Set the version reply, so if anyone is profiling the //network, it makes it harder for them
    };
    
    zone "." {
    type hint;
    file "/var/named/named.root";
    };
    
    Now part 3 will show how to set up named so it serves zones.

  5. #5
    ConorP is offline Coder ConorP will become famous soon enough
    Join Date
    May 2007
    Location
    Dublin
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok lets serve some domains

    You want to add a section to your named.conf to tell it, that it is authoritative server for your domain

    Lets say we want to host irishwebmasterforum.com and our nameserver is ns1.myserver.com (I should explain this bit) and our nice geographically diverse second nameserver (I'm looking at some hosts here ) is ns2.myserver.com

    We'd add this to our named.conf

    Code:
    zone "irishwebmasterforum.com" {
    type master;
    file "/var/named/irishwebmasterforum.com.db";
    };
    
    I know updates have been a little sparse over the last week or two... or three... been busy with job hunting and other stuff.

  6. #6
    ConorP is offline Coder ConorP will become famous soon enough
    Join Date
    May 2007
    Location
    Dublin
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Actually I should clear this up a bit more to avoid confusion.. that I've probably already caused.

    The machine we are using *is* ns1.myserver.com

    So lets open up the zone file for irishwebmasterforum.com

    nano /var/named/irishwebmasterforum.com.db
    And we should have a nice blank file to work with.

+ Reply to Thread

Similar Threads

  1. Script Installation, Server Administration
    By bizhat in forum Marketplace Offers
    Replies: 2
    Last Post: 10-03-2008, 12:29 PM
  2. Setting up a server
    By daviddoran in forum Server / Technical Administration Tips and Queries
    Replies: 4
    Last Post: 21-02-2007, 03:00 PM
  3. setting up web server tutorials
    By georgiecasey in forum Server / Technical Administration Tips and Queries
    Replies: 3
    Last Post: 17-02-2007, 07:23 PM
  4. Delete Or Redirect Files From Server?
    By Peter McC in forum Webmaster Discussion
    Replies: 4
    Last Post: 14-02-2007, 01:32 PM
  5. Server security
    By grandad in forum Webmaster Discussion
    Replies: 0
    Last Post: 20-02-2006, 06:07 PM

Visitors found this page by searching for:

Nobody landed on this page from a search engine, yet!
SEO Blog

Tags for this Thread

Posting Permissions

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

Search Engine Optimization by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64