Bind – Delegate Sub-domain

Di artikel ini akan saya sampaikan bagaimana mendelegasikan sebuah sub-domain ke name server lain. Contoh kasus seperti ini :

* zone (domain) name = example.com
* domain host name = server.example.com
* sub-domain name = id.example.com
* sub-domain host name = ftp.id.example.com

Yang akan kita lakukan adalah semua hostname dari sub-domain id.example.com akan di atur di dns tersendiri.
name servers yang digunakan adalah BIND .

1. Yang pertama kita lakukan edit named.conf pada bind untuk zone example.com

// named.conf file fragment
….
options {
….
allow-transfer {“none”;};
….
};
zone “example.com” in{
type master;
file “master/master.example.com”;
allow-transfer {192.168.0.4;};
};
// optional – we act as the slave (secondary) for the delegated domain
zone “us.example.com” IN {
type slave;
file “slave/slave.id.example.com”;
masters {10.10.0.24;};
};

Selanjutnya kita perlu membuat file Domain Name-Server Zone, nama file yang di pakai ‘master.example.com
Tambahkan baris berikut ke dalam file master.example.com.

; zone fragment for example.com
; name servers in the same zone
$TTL 2d ; default TTL is 2 days
$ORIGIN example.com.
@              IN      SOA   ns1.example.com. hostmaster.example.com. (
2003080800 ; serial number
2h         ; refresh =  2 hours
15M        ; update retry = 15 minutes
3W12h      ; expiry = 3 weeks + 12 hours
2h20M      ; minimum = 2 hours + 20 minutes
)
; main domain name servers
IN      NS     ns1.example.com.
IN      NS     ns2.example.com.
; main domain mail servers
IN      MX      mail.example.com.
; A records for name servers above
ns1           IN      A      192.168.0.3
ns2           IN      A      192.168.0.4
; A record for mail server above
mail          IN      A      192.168.0.5
….

; sub-domain definitions
$ORIGIN id.example.com.
; we define two name servers for the sub-domain
@             IN      NS     ns3.id.example.com.
; the record above could have been written without the $ORIGIN as
; us.example.com. IN NS ns3.id.example.com.
; OR as simply
;      IN NS   ns3
; the next name server points to ns1 above
IN      NS     ns1.example.com.
; sub-domain address records for name server only – glue record
ns3           IN      A      10.10.0.24 ; ‘glue’ record
; the record above could have been written as
; ns3.id.example.com. A 10.10.0.24 if it’s less confusing

2. Konfigurasi name server di sub-domain

Tambahkan baris berikut di file ‘named.conf’ :

// named.conf file fragment
….
options {
….
allow-transfer {“none”;};
….
};
zone “id.example.com” in{
type master;
file “master/master.id.example.com”;
// explicitly allow slave
allow-transfer {192.168.0.3;};
};

File Sub-domain Zone sesuai  konfigurasi di  named.conf adalah master.id.example.com . isikan baris berikut :

; zone fragment for sub-domain id.example.com
; name servers in the same zone
$TTL 2d ; default TTL = 2 days
$ORIGIN id.example.com.
@              IN     SOA   ns3.id.example.com. hostmaster.id.example.com. (
2003080800 ; serial number
2h         ; refresh =  2 hours
15M        ; update retry = 15 minutes
3W12h      ; expiry = 3 weeks + 12 hours
2h20M      ; minimum = 2 hours + 20 minutes
)
; sub-domain name servers
IN      NS     ns3.id.example.com.
IN      NS     ns1.example.com. ; see notes below
; sub-domain mail server
IN      MX 10  mail.id.example.com.
; above record could have been written as
;                 IN      MX 10  mail
; A records for name servers above
ns3               IN      A      10.10.0.24
ns1.example.com.  IN      A      192.168.0.3 ; ‘glue’ record
; A record for mail server above
mail              IN      A      10.10.0.25
; next record defines our ftp server
ftp               IN      A      10.10.0.28
; the record above could have been written as
; ftp.us.example.com. A 10.10.0.28 if it’s less confusing
….
; other sub-domain records
….

Sudah deh jadi, maka setiap request subdomain id.example.com akan dilayani oleh name server di ns3.id.example.com