Skrevet av Emne: Setting up a RedHat Linux based DNS server  (Lest 5026 ganger)

ATC

  • Gjest
Setting up a RedHat Linux based DNS server
« på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • This article attempts to explain how to set up a RedHat Linux based Domain Name Server for a single "zone". (How to add more zones later on will be self-explanatory)

    We assume that you have a working Linux box up and running, we also assumes you have some knowledge about the DNS hierarchy and how to register Second Level Domain names like "yourdomain.com" with the proper internet naming authorities.



    ATC

    • Gjest
    [Solved] Setting up a RedHat Linux based DNS server
    « Svar #1 på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • 1. Install the following rpm packages: "bind", "bind-utils" and "caching-nameserver" if you have not already done so.
    2. Edit the nameserver config file "/etc/named.conf" and add an entry for your zone on the following format:

    zone "yourdomain.com" {
            type master;
            file "yourdomain.com.hosts";
    };

    Note: If you're setting up a SECONDARY nameserver, the zone entry should look like this:


    zone "yourdomain.com" {
            type slave;
            file "yourdomain.com.BACKUP";
            masters { 1.2.3.4; };  # IP address of PRIMARY server
    };


    3. Create a zone file "/var/named/yourdomain.com.hosts". This is where you'll add DNS records for the domain. The file should look like this:


    $ORIGIN yourdomain.com.
    @               IN      SOA             yourmachine.yourdomain.com. yourusername.yourdomain.com.
                                            (
                                            2000021101      ; serial
                                            10800           ; refresh
                                            3600            ; retry
                                            3600000         ; expire
                                            86400           ; minimum
                                            )


                    IN      NS              ns.yourdomain.com.
                    IN      NS              ns2.yourdomain.com.
                    IN      MX      10      mail.yourdomain.com.
    mail            IN      A               1.2.3.4
    www             IN      A               1.2.3.4


    A note on serial numbers. This number MUST be incremented EVERY TIME you make changes to the zone file, or the changes will be ignored. You will forget this at some point, so make a habit of always double-checking this whenever you have problems with a zone.

    The recommended format is YYYYMMDDRR, where RR is a revision number 00 thru 99 for that date. (If you ever make more than 100 changes in a single day, give me a call)

    4. Finally, start the nameserver if it's not already running by issuing the command "/etc/rc.d/init.d/named start", or simply order a reload if it's already running: "/etc/rc.d/init.d/named reload".

    5. Check the system log "/var/log/messages" to verify that everything worked OK. You will see at least one line for each zone, warning you if there was a problem with that zone.

    For more detailed information, please refer to "man named.conf" or see the official BIND homepage at "http://www.isc.org/products/BIND/"