06 June 2012

howto configure DNS on redhat 7

yum install bind 
yum install bind-utils
yum install caching-nameserver
service named restart
chkconfig named on

vi /etc/named.caching-nameserver.conf
options {
  listen-on port 53 { 127.0.0.1; machine-IP; };
  allow-query     { any; };
  forwarders { 8.8.8.8; 8.8.4.4; };
...
};

service named restart
dig www.google.com @machine-IP
;; ANSWER SECTION:
www.google.com.         101137  IN      CNAME   www.l.google.com.
www.l.google.com.       262     IN      A       74.125.225.177
www.l.google.com.       262     IN      A       74.125.225.178
www.l.google.com.       262     IN      A       74.125.225.179
www.l.google.com.       262     IN      A       74.125.225.180
www.l.google.com.       262     IN      A       74.125.225.176
...
vi /etc/named.caching-nameserver.conf
#view localhost_resolver {
#   match-clients      { localhost; };
#   match-destinations { localhost; };
#   recursion yes;
#   include "/etc/named.rfc1912.zones";
#};
include "/etc/named.humblesimple.com.zones";

cat > /etc/named.humblesimple.com.zones << EOF
zone "humblesimple.com" IN {
        type master;
        file "named.humblesimple.com-forward";
        allow-update { none; };
};

zone "10.21.168.198.in-addr.arpa" IN {
        type master;
        file "named.humblesimple.com-reverse";
        allow-update { none; };
};
EOF

cat > /var/named/named.humblesimple.com-forward << EOF
$TTL 1D
@       IN SOA  humblesimple.com.     root (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        IN      A       192.168.21.10
        IN      NS      192.168.21.10
server1 IN      A       192.168.21.11
EOF

cat > /var/named/named.humblesimple.com-reverse<< EOF
$TTL 1D
@       IN SOA  @ humblesimple.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        PTR     192.168.21.10.
EOF

service named restart
dig server1.humblesimple.com @machine-IP
;; ANSWER SECTION:
server1.humblesimple.com. 86400 IN      A       192.168.21.11
...
Reference:
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch18_:_Configuring_DNS

No comments:

Post a Comment