Bind (DNS)

From INIwiki
Jump to: navigation, search

Digg this!

Also See Bind Master Slave

Contents

[edit] Install DNS Server

Debian Systems

To host both an internal and external DNS server you need to install bind9 and the dnsutils packages

apt-get install bind9 dnsutils

[edit] Backup named.conf files

rsync -avP /etc/bind* /etc/bind-ORG

[edit] Edit the named.conf file

vi /etc/bind/named.conf   -or- vi /etc/bind9/named.conf
Focus on the yourdomain.com and IPsections below
cat > /etc/bind/named.conf

// ACL statement
acl "trusted-subnet" { 10.10.10.0/24; 192.168.20.0/20; };
controls {
     inet 127.0.0.1 port 953
             allow { 127.0.0.1; } keys { "rndckey"; };
};
options {
directory "/etc/bind";
pid-file "named.pid";
};
 
view "internal" {
   match-clients { localnets; localhost; "trusted-subnet"; };
       zone "." IN {
               type hint;
               file "named.ca";
       };
       zone "localhost" IN {
               type master;
               file "localhost.zone";
               allow-update { none; };
       };
       zone "0.0.127.in-addr.arpa" IN {
               type master;
               file "named.local";
               allow-update { none; };
       };
       zone "yourdomain.com" IN {'''
               type master;'''
               file "yourdomain.com.zone";'''
               allow-update { none; };'''
       zone "trusteddomain.com" {'''
       type forward;'''
       forwarders { 192.168.1.27; 192.168.1.26;};'''
       };
};
view "external" {
   match-clients { any; };
   recursion no;
       zone "yourdomain.com" IN {
               type master;
               file "yourdomain.com.zone.external";
               allow-update {
                       none;
                       };
               notify yes;
       };
};

(Now hit Control-D to end cat input)

Remember to Edit the file you just created

vi /etc/bind9/named.conf

[edit] Create your local zone file

vi /etc/bind/yourdomain.com.zone
$TTL 600
@       IN      SOA     ns1.yourdomain.com.  admin.yourdomain.com. (
                       2005101601 ; serial
                       600 ; refresh
                       600 ; retry
                       600 ; expire
                       600 ; ttl
                       )

               IN      NS      ns1.yourdomain.com.

@               IN      MX      5       mail1

mail1           IN      A       10.10.10.10; Your private (LAN) ip address here

www             IN      CNAME   @


[edit] Create your external domain file

vi /etc/bind/yourdomain.com.zone.external
$TTL 600
@       IN      SOA     ns1.yourdomain.com.  admin.yourdomain.com. (
                       2005101601 ; serial
                       600 ; refresh
                       600 ; retry
                       600 ; expire
                       600 ; ttl
                       )

               IN      NS      ns1.yourdomain.com.

@               IN      MX      5       mail1

mail1           IN      A       64.233.167.99  ; Your public ip address here

www             IN      CNAME   @

[edit] Reference

http://www.debian-administration.org/articles/355
http://www.pantz.org/os/openbsd/bind9.shtml
http://www.howtoforge.com/debian_bind9_master_slave_system
Personal tools