Friday, September 17, 2010

How to Setup DNS in Linux

To setup DNS in Linux, make sure we have BIND package installed.
1. Add these lines in /etc/resolv.conf
domain fw-geekycoder.com
nameserver 172.16.242.129
2. Add forward and reverse zones in /etc/named.conf
zone "fw-geekycoder" in {
    type master;
    file "master/fw-geekycoder.zone";
};

zone "242.16.172.in-addr.arpa" in {
    type master;
    file "master/242.16.172.zone";
};
3. As you we can see in step two, there are two zone files that need to be created.
In /var/lib/named/master/fw-geekycoder.zone file
$TTL 1W
@       IN SOA  ns1.fw-geekycoder.com. root.fw-geekycoder.com. (
                                2010191505      ; serial (d. adams)
                                2D              ; refresh
                                4H              ; retry
                                6W              ; expiry
                                1W )            ; minimum

fw-geekycoder.com.      IN NS           ns1.fw-geekycoder.com.
ns1                     IN A            172.16.242.129
www                     IN A            172.16.242.129
gateway                 IN A            172.16.242.2
In 242.16.172.zone file
$TTL 1W
@       IN SOA  ns1.fw-geekycoder.com. root.fw-geekycoder.com. (
                                2010191605      ; serial (d. adams)
                                2D              ; refresh
                                4H              ; retry
                                6W              ; expiry
                                1W )            ; minimum

129.242.16.172.in-addr.arpa.    IN NS           ns1.fw-geekycoder.com.
129                             IN PTR          ns1.fw-geekycoder.com.
129                             IN PTR          www.fw-geekycoder.com.
2                               IN PTR          gateway.fw-geekycoder.com.
4. Restart the named daemon.
/etc/init.d/named restart

No comments:

Post a Comment