bind-9.1.3-4 (DNS)

Example Network

Sample Network
Domain Name hoge.edu.bt
Network Address 202.144.157.208
Subnet Mask 255.255.255.240
Hosts
Host Name IP Address
ns1 (Master DNS),
pop3, smtp, news
202.144.157.209
www (Slave DNS),
ns2, ftp, ntp
202.144.157.210
www (Multi Home Host) 192.168.1.1
Round Robin
proxy 202.144.157.212
proxy 202.144.157.213

Location of setting files

Files
Path
/etc/resolv.conf Setting files for Client
/etc/named.conf Setting files for DNS server
/var/named/hoge.zone Zone file
/var/named/202.144.157.208.zone Reverse zone file

Configure

  • /etc/named.conf for Master DNS
    // generated by named-bootconf.pl
    
    options {
            directory "/var/named";
            /*
             * If there is a firewall between you and nameservers you want
             * to talk to, you might need to uncomment the query-source
             * directive below.  Previous versions of BIND always asked
             * questions using port 53, but BIND 8.1 uses an unprivileged
             * port by default.
             */
            // query-source address * port 53;
    };
    
    //
    // a caching only nameserver config
    //
    controls {
            inet 127.0.0.1 allow { localhost; } keys { rndckey; };
    };
    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; };
    };
    
    include "/etc/rndc.key";
    
    
    # Master Zone File
    zone "hoge.edu.bt" {
    	type master;
    	file "hoge.zone";
    };
    
    zone "208.157.144.202.in-addr.arpa" {
    	type master;
    	file "202.144.157.208.zone";
    };
    
  • /etc/named.conf for Slave DNS

    // generated by named-bootconf.pl
    
    options {
            directory "/var/named";
            /*
             * If there is a firewall between you and nameservers you want
             * to talk to, you might need to uncomment the query-source
             * directive below.  Previous versions of BIND always asked
             * questions using port 53, but BIND 8.1 uses an unprivileged
             * port by default.
             */
            // query-source address * port 53;
    };
    
    //
    // a caching only nameserver config
    //
    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 "hoge.edu.bt" {
            type slave;
            file "hoge.zone";
            masters {202.144.157.209;};
    };
    
    zone "157.144.202.in-addr.arpa" {
            type slave;
            file "202.144.157.208.zone";
            masters {202.144.157.209;};
    };
    
    
    
  • /var/named/hoge.zone
    $TTL 3D
    @      SOA     ns1.hoge.edu.bt. root.ns1.hoge.edu.bt. (
                            2000091504      ; serial number
                            36000           ; refresh 10 hours
                            3600            ; retry   1  hour
                            3600000         ; expire  42 days
                            360000          ; minimum 100 hours
                            )
    ; Name Server
                    IN      NS      ns1.hoge.edu.bt.
                    IN      NS      www.hoge.edu.bt.
    
                    IN      A       202.144.157.209
                    IN      MX      10 ns1.hoge.edu.bt.
                    IN      MX      20 www.hoge.edu.bt.
    
    localhost       IN      A       127.0.0.1
    loghost         IN      CNAME   localhost
    
    ; Multi Home Host
    ns1             IN      A       202.144.157.209
    pop3            IN      CNAME   ns1
    smtp            IN      CNAME   ns1
    news            IN      CNAME   ns1
    ;               IN      HINFO   INTEL Linux BOX
    
    ; Round Robin
    proxy           IN      A       202.144.157.212
    proxy           IN      A       202.144.157.213
    
    ; Multi Home Host
    www             IN      A       192.168.1.1
    www             IN      A       202.144.157.210
    ns2             IN      CNAME   www
    ftp             IN      CNAME   www
    ntp             IN      CNAME   www
    ;               IN      HINFO   INTEL Linux BOX
    
    gw-hoge          IN      A       202.144.157.222
    ;               IN      HINFO   ROUTER CISCO 1600
    
    
  • /var/named/202.144.157.208.zone (Reverse mapping file)
    $TTL 3D
    @               IN      SOA     ns1.hoge.edu.bt. root.ns1.hoge.edu.bt. (
                            2000091506 ; serial
                            36000 ; refresh
                            3600 ; retry
                            3600000 ; expire
                            360000 ; default_ttl
                            )
    
                    IN      NS      ns1.hoge.edu.bt.
    
    @               IN      PTR     hoge.edu.bt.
    @               IN      A       255.255.255.240
    208             IN      PTR     hoge-net.hoge.edu.bt.
    209             IN      PTR     ns1.hoge.edu.bt.
    210             IN      PTR     www.hoge.edu.bt.
    212             IN      PTR     proxy.hoge.edu.bt.
    213             IN      PTR     proxy.hoge.edu.bt.
    222             IN      PTR     gw-hoge.hoge.edu.bt.
    

    Create a sub domain and delegate a domain right

  • How to create sub domains (sushi, sashimi, natto) under a domain (hoge.edu.bt). It delegates
    hoge.edu.bt.edu.        IN  NS	sushi.hoge.edu.bt.
    hoge.edu.bt.edu.        IN  NS	sashimi.hoge.edu.bt.
    hoge.edu.bt.edu.        IN  NS	natto.hoge.edu.bt.
    
    sushi.hoge.edu.bt.      IN  A   192.253.254.1
    sashimi.hoge.edu.bt.    IN  A   192.253.254.5
    natto.hoge.edu.bt.      IN  A   192.253.20.1
    

    Setting for DNS Client

  • /etc/resolv.conf
    search hoge.edu.bt
    domain hoge.edu.bt
    # hoge
    nameserver 202.144.157.209
    nameserver 202.144.157.210
    

    How to start

    # /etc/init.d/named restart
    

    How to check

  • [nslookup] command
    nslookup Host Name
    nslookup IP Address
    nslookup -q Domain Name
    nslookup -q=ns Domain Name
    
  • How to check
    [root@ns1 /etc]# nslookup
    Default Server:  ns1.hoge.edu.bt
    Address:  202.144.157.209
    
    > ns1
    Server:  ns1.hoge.edu.bt
    Address:  202.144.157.209
    
    Name:    ns1.hoge.edu.bt
    Address:  202.144.157.209
    
    > www
    Server:  ns1.hoge.edu.bt
    Address:  202.144.157.209
    
    Name:    www.hoge.edu.bt
    Addresses:  192.168.1.1, 202.144.157.210
    
    > proxy
    Server:  ns1.hoge.edu.bt
    Address:  202.144.157.209
    
    Name:    proxy.hoge.edu.bt
    Addresses:  202.144.157.212, 202.144.157.213
    
    > set type=mx
    > hoge.edu.bt
    Server:  ns1.hoge.edu.bt
    Address:  202.144.157.209
    
    hoge.edu.bt      preference = 10, mail exchanger = ns1.hoge.edu.bt
    hoge.edu.bt      preference = 20, mail exchanger = www.hoge.edu.bt
    hoge.edu.bt      nameserver = ns1.hoge.edu.bt
    hoge.edu.bt      nameserver = www.hoge.edu.bt
    ns1.hoge.edu.bt  internet address = 202.144.157.209
    www.hoge.edu.bt  internet address = 192.168.1.1
    www.hoge.edu.bt  internet address = 202.144.157.210
    

    Back
    Google
    Web www.grape-info.com