Berikut catatan saya mengenai DNS yang mengunakan IP Public.
Awalnya kita tidak memiliki DNS yang terhubung ke Public. DNS Public hanya ada di ISP dengan menggunakan control Panel.
Untuk memudahkan pengelolaan kita akan membuat DNS yang terhubung ke IP Public. Dan pengelolaan Domain tidak lagi di Control Panel ISP atau Situs Penjual Domain.
Sebelum merubah domain corporate, saya coba membeli domain baru contoh example.xyz Kebetulan domain tersebut tersebut lumayan murah hanya Rp. 16.000/tahun. Yah untuk coba2 dan testing.
Berikut gambarannya (bukan sebenarnya):
NS Godady : ns1.godaddy.com dan ns2.godaddy.com
Lokasi A (Master)
IP Public Mikrotik : 103.4.x.x
Server DNS :192.168.100.3
Lokasi B (Slave)
IP Public Mikrotik 117.102.x.x dan 112.78.x,x
Server DNS : 192,168.200.3
Domain yang saya beli di godaddy.com lantas saya coba rubah untuk NS (Name Server).
Di halaman godaddy sudah ada 2 alamat NS default. Anehnya NS tersebut tidak dapat diedit diganti dengan IP Public A. Jadi ketika kita menambahkan NS, maka NS yang kita buat akan hilang dan masih menggunakan NS default. Dan mungkin ada kesalahan dari saya perihal konfigurasinya.
Berikut konfigurasi setelah beberapa kali Trial Error.
Tahapan :
Lokasi A (Master) Centos 6.5
1. Setting di /etc/named.conf
options {
// listen-on port 53 { 127.0.0.1; };
listen-on port 53 { 192.168.100.3; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
// allow-query { localhost; };
allow-query { any; };
// allow-recursion { 127.0.0.1; };
allow-transfer { 127.0.0.1; 117.102.x.x; };
recursion no;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
forwarders {180.131.144.144; 8.8.4.4; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "ithighpro.xyz" in {
type master;
file "example.xyz.zone";
allow-update { none; };
};
zone "100.168.192.in-addr.arpa" in {
type master;
file "100.168.192.in-addr.arpa.zone";
allow-update { none; };
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
!!! Recursion disetting no untuk menghindari Ddos attack
2. Setting file zona /var/named/example.xyz.zone
$TTL 1d
@ 600 IN SOA ns1.example.xyz. root.ithighpro.xyz. (
201611xx
28800
7200
604800
600
)
;Name server's
@ IN NS ns1.ithighpro.xyz.
@ IN NS ns2.ithighpro.xyz.
;Name server hostname to IP resolve
@ IN A 103.4.x.x
@ IN A 117.102.x.x
;MX Records
@ IN MX 10 mail.example.xyz.
@ IN MX 20 mail2.example.xyz.
;Hosts in this Domain
ns1 IN A 103.4.x.x
ns2 IN A 117.102.x.x
mail IN A 103.4.x.x
mail2 IN A 117.102.x.x
www IN A 117.102.x.x
owncloud IN A 112.78.x.x
Untuk mengecek konfigurasi yang sudah pernah kita buat bisa menjalan perintah :
[root@mail named]#named-checkconf /etc/named.conf
[root@mail named]#named-checkzone example.xyz /var/named/example.xyz.zone
zone example.xyz/IN: loaded serial 201611xx
OK
Jika hasilnya sudah seperti diatas berarti konfigurasi sudah dianggap benar.
Lokasi B (Slave) Centos 7.2
1. Edit File /etc.named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.200.3; };
# listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-transfer { 127.0.0.1; 103.4.x.x; };
/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recurs ion.
- If you are building a RECURSIVE (caching) DNS server, you need to ena ble
recursion.
- If your recursive DNS server has a public IP address, you MUST enable access
control to limit queries to your legitimate users. Failing to do so w ill
cause your server to become part of large scale DNS amplification
attacks. Implementing BCP38 within your network would greatly
reduce such attack surface
*/
recursion no;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "example.xyz" IN {
type slave;
file "slaves/example.xyz.zone";
masters { 103.4.x.x; };
};
2. Edit File Zona /var/named/slaves/example.xyz.zone
$TTL 86400
@ IN SOA ns1.example.xyz. root.example.xyz. (
201611xxx ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
NS ns1.example.xyz.
NS ns2.example.xyz.
A 103.4.x.x
; A 192.168.200.3
MX 10 mail.example.xyz.
MX 20 mail2.example.xyz.
ns1 A 103.4.x.x
ns2 A 192.168.200.3
mail A 103.4.x.x
mail2 A 117.102.x.x
www A 117.102.x.x
Tools untuk membantu pengecekan konfigurasi :
- https://intodns.com/example.xyz
Di tools ini kita bisa melihat konfigurasi yang kurang tepat.
Beberapa hal penting :
1. Untuk serial di zona file harus disamakan antara master dan slaves
2. Pengeditan/penambahan NS di Godaddy disebabkan NS yang kita buat belum terbentuk. Dan minimal NS haru ada 2. Jika hanya 1 maka NS masih menggunakan Godaddy
3. Setelah DNS di 2 lokasi terbentuk maka secara otomatis pengelolaan domain ada di Lokasi kita bukan di Godaddy.
Awalnya kita tidak memiliki DNS yang terhubung ke Public. DNS Public hanya ada di ISP dengan menggunakan control Panel.
Untuk memudahkan pengelolaan kita akan membuat DNS yang terhubung ke IP Public. Dan pengelolaan Domain tidak lagi di Control Panel ISP atau Situs Penjual Domain.
Sebelum merubah domain corporate, saya coba membeli domain baru contoh example.xyz Kebetulan domain tersebut tersebut lumayan murah hanya Rp. 16.000/tahun. Yah untuk coba2 dan testing.
Berikut gambarannya (bukan sebenarnya):
NS Godady : ns1.godaddy.com dan ns2.godaddy.com
Lokasi A (Master)
IP Public Mikrotik : 103.4.x.x
Server DNS :192.168.100.3
Lokasi B (Slave)
IP Public Mikrotik 117.102.x.x dan 112.78.x,x
Server DNS : 192,168.200.3
Domain yang saya beli di godaddy.com lantas saya coba rubah untuk NS (Name Server).
Di halaman godaddy sudah ada 2 alamat NS default. Anehnya NS tersebut tidak dapat diedit diganti dengan IP Public A. Jadi ketika kita menambahkan NS, maka NS yang kita buat akan hilang dan masih menggunakan NS default. Dan mungkin ada kesalahan dari saya perihal konfigurasinya.
Berikut konfigurasi setelah beberapa kali Trial Error.
Tahapan :
Lokasi A (Master) Centos 6.5
1. Setting di /etc/named.conf
options {
// listen-on port 53 { 127.0.0.1; };
listen-on port 53 { 192.168.100.3; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
// allow-query { localhost; };
allow-query { any; };
// allow-recursion { 127.0.0.1; };
allow-transfer { 127.0.0.1; 117.102.x.x; };
recursion no;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
forwarders {180.131.144.144; 8.8.4.4; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "ithighpro.xyz" in {
type master;
file "example.xyz.zone";
allow-update { none; };
};
zone "100.168.192.in-addr.arpa" in {
type master;
file "100.168.192.in-addr.arpa.zone";
allow-update { none; };
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
!!! Recursion disetting no untuk menghindari Ddos attack
2. Setting file zona /var/named/example.xyz.zone
$TTL 1d
@ 600 IN SOA ns1.example.xyz. root.ithighpro.xyz. (
201611xx
28800
7200
604800
600
)
;Name server's
@ IN NS ns1.ithighpro.xyz.
@ IN NS ns2.ithighpro.xyz.
;Name server hostname to IP resolve
@ IN A 103.4.x.x
@ IN A 117.102.x.x
;MX Records
@ IN MX 10 mail.example.xyz.
@ IN MX 20 mail2.example.xyz.
;Hosts in this Domain
ns1 IN A 103.4.x.x
ns2 IN A 117.102.x.x
mail IN A 103.4.x.x
mail2 IN A 117.102.x.x
www IN A 117.102.x.x
owncloud IN A 112.78.x.x
Untuk mengecek konfigurasi yang sudah pernah kita buat bisa menjalan perintah :
[root@mail named]#named-checkconf /etc/named.conf
[root@mail named]#named-checkzone example.xyz /var/named/example.xyz.zone
zone example.xyz/IN: loaded serial 201611xx
OK
Jika hasilnya sudah seperti diatas berarti konfigurasi sudah dianggap benar.
Lokasi B (Slave) Centos 7.2
1. Edit File /etc.named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.200.3; };
# listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-transfer { 127.0.0.1; 103.4.x.x; };
/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recurs ion.
- If you are building a RECURSIVE (caching) DNS server, you need to ena ble
recursion.
- If your recursive DNS server has a public IP address, you MUST enable access
control to limit queries to your legitimate users. Failing to do so w ill
cause your server to become part of large scale DNS amplification
attacks. Implementing BCP38 within your network would greatly
reduce such attack surface
*/
recursion no;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "example.xyz" IN {
type slave;
file "slaves/example.xyz.zone";
masters { 103.4.x.x; };
};
2. Edit File Zona /var/named/slaves/example.xyz.zone
$TTL 86400
@ IN SOA ns1.example.xyz. root.example.xyz. (
201611xxx ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
NS ns1.example.xyz.
NS ns2.example.xyz.
A 103.4.x.x
; A 192.168.200.3
MX 10 mail.example.xyz.
MX 20 mail2.example.xyz.
ns1 A 103.4.x.x
ns2 A 192.168.200.3
mail A 103.4.x.x
mail2 A 117.102.x.x
www A 117.102.x.x
Tools untuk membantu pengecekan konfigurasi :
- https://intodns.com/example.xyz
Di tools ini kita bisa melihat konfigurasi yang kurang tepat.
Beberapa hal penting :
1. Untuk serial di zona file harus disamakan antara master dan slaves
2. Pengeditan/penambahan NS di Godaddy disebabkan NS yang kita buat belum terbentuk. Dan minimal NS haru ada 2. Jika hanya 1 maka NS masih menggunakan Godaddy
3. Setelah DNS di 2 lokasi terbentuk maka secara otomatis pengelolaan domain ada di Lokasi kita bukan di Godaddy.