How to set up a DNS server(at Home)

Seann Clark nombrandue at tsukinokage.net
Wed Jan 28 16:35:30 UTC 2009


gmspro at yahoo.com wrote:
> Hi,
> Typing this "rpm -q bind" got this:
> bind-9.5.1-0.8.b2.fc10.i386
>
> In "named.conf file" I got this:
>
> //
> // named.conf
> //
> // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
> // server as a caching only nameserver (as a localhost DNS resolver only).
> //
> // See /usr/share/doc/bind*/sample/ for example named configuration files.
> //
>
> options {
>     listen-on port 53 { 127.0.0.1; };
>     listen-on-v6 port 53 { ::1; };
>     directory     "/var/named";
>     dump-file     "/var/named/data/cache_dump.db";
>         statistics-file "/var/named/data/named_stats.txt";
>         memstatistics-file "/var/named/data/named_mem_stats.txt";
>     allow-query     { localhost; };
>     recursion yes;
> };
>
> logging {
>         channel default_debug {
>                 file "data/named.run";
>                 severity dynamic;
>         };
> };
>
> zone "." IN {
>     type hint;
>     file "named.ca";
> };
>
> include "/etc/named.rfc1912.zones";
>
> And in "named.rfc1912.zones"
>
> // named.rfc1912.zones:
> //
> // Provided by Red Hat caching-nameserver package
> //
> // ISC BIND named zone configuration for zones recommended by
> // RFC 1912 section 4.1 : localhost TLDs and address zones
> // and 
> http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
> // (c)2007 R W Franks
> //
> // See /usr/share/doc/bind*/sample/ for example named configuration files.
> //
>
> zone "localhost.localdomain" IN {
>     type master;
>     file "named.localhost";
>     allow-update { none; };
> };
>
> zone "localhost" IN {
>     type master;
>     file "named.localhost";
>     allow-update { none; };
> };
>
> zone 
> "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" 
> IN {
>     type master;
>     file "named.loopback";
>     allow-update { none; };
> };
>
> zone "1.0.0.127.in-addr.arpa" IN {
>     type master;
>     file "named.loopback";
>     allow-update { none; };
> };
>
> zone "0.in-addr.arpa" IN {
>     type master;
>     file "named.empty";
>     allow-update { none; };
> };
>
> Can anyone explain the file contents in detail and about named.ca?
> And what I have to do in step by step to set up a dns server ?
>
> PC configuration(Home):
> Processor:Intel Pentium D 2.66GHz
> Ram:1GB
> Hard Disk:80GB
>
>
>
I hate to plug books, but this may be the easiest way to get an good 
explanation to a home user of the components on a DNS server. Check out 
http://my.safaribooksonline.com/0596100574 Which is the DNS BIND book, 
which is a very valuable asset when learning DNS.


In a quick nutshell, the named.ca file contains the IP addresses and 
names of the 'root' DNS servers in the world. These are the 'dot' in 
your .com/.net etc (actually it is the dot AFTER the .com but that is a 
little complex to get into) That file helps you find the DNS server of 
the domain you are after, starting at the root, or . and working down 
to, say if you are looking for www.google.com, going from the . DNS to 
the .com DNS to the google.com DNS.

Simplest way to set up a home DNS, copy the 'localhost.localdomain' 
file, keep everything down past to the NS listings (I believe it should 
be NS  localhost in that line) and then add in your hostnames and IP's 
in a format like


host1            IN A   10.1.1.1
host2            IN A   10.1.1.2
host3            IN A   10.1.1.3


Where IN is the most common use that you will find and works well in 
this situation (Stands for Internet Name, I believe) and A stands for 
the type of record. You can, after you have a few A entires, add in a 
CNAME like this


alias      IN CNAME   host1.domain.net



After you are done with this, you need to copy named.loopback and remove 
the same portion in that file as you did with the first file we edited. 
The format in this is a little different. If your network IP range is as 
describe above you would have to add in the following entires:

1         IN PTR  host1.domain.net.
2         IN PTR  host2.domain.net.
3         IN PTR  host3.domain.net.


Where PTR stands for pointer, and this provides IP to name resolution.


your completed new domain file should be set up like this:

$ORIGIN .
$TTL 86400      ; 1 day
domain.net         IN SOA  dns.domain.net. root.domain.net. (
                                2009012801 ; serial - When updating the 
file, use current date and revision number as follows : yyyymmddrr
                                10800      ; refresh (3 hours)
                                900        ; retry (15 minutes)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
                        NS      dns.domain.net
               
host1            IN A   10.1.1.1
host2            IN A   10.1.1.2
host3            IN A   10.1.1.3



And your pointer record should look similar to that (1.1.10.in-addr.arpa 
instead of domain.net in the IN SOA line.)

After that, in your named.conf file you need to add in those two new 
files into the configurations:


zone "domain.net" IN {
    type master;
    file "domain.net";
    allow-update { none; };
};

zone "1.1.10.in-addr.arpa" IN {
    type master;
    file "1.1.10.conf";
    allow-update { none; };
};

After you start named up (service start named) if it starts file, you 
should be good to go. Since this is a fedora system named runs by 
default in a chroot jail so you can find all the files under:
/var/named/chroot/

to check the logs for your troubleshooting if you have issues, should be 
in /var/named/chroot/var/log or in /var/log depending on how  it is set 
up. I don't remember completely since it has been a long time since I 
have used default logging on a DNS.

Few Gotcha's:
in the PTR file, remember periods at the end of the lines for the host 
names. In the named.conf, make sure you didn't forget a semi-colon, as 
these are a royal pain to find (the logs give you an approximate 
position as to where it was missing/broke, but nothing exact) and it can 
be trying on the eyes. Also make sure if you use a firewall that TCP and 
UDP port 53 is opened.


Regards,
Seann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5614 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090128/0b34c403/attachment-0001.bin>


More information about the fedora-list mailing list