PowerDNS: Memasukan Record SOA NS A MX ke Database

From OnnoWiki
Jump to navigation Jump to search

Masuk ke MySQL

mysql -u root -p123456


Gunakan database

misalnya

use powerdns;

Domain / Zone

Membuat sebuah zone / domain

INSERT INTO domains (name, type) values ('example.com', 'NATIVE');

SOA

INSERT INTO records (domain_id, name, content, type,ttl,prio) 
VALUES (1,'example.com','localhost ahu@ds9a.nl 1','SOA',86400,NULL);

NS

INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'example.com','dns-us1.powerdns.net','NS',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'example.com','dns-eu1.powerdns.net','NS',86400,NULL);

A

INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'www.example.com','192.0.2.10','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'mail.example.com','192.0.2.12','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'localhost.example.com','127.0.0.1','A',120,NULL);

AAAA

INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'www.example.com','2001:470:36:ab6::100','AAAA',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'mail.example.com','2001:470:36:ab6::100','AAAA',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'localhost.example.com','::1','AAAA',120,NULL);

MX

INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'example.com','mail.example.com','MX',120,25);


Contoh Sebuah Domain

mysql -u root -p123456
use powerdns;
INSERT INTO domains (name, type) values ('contoh.web.id', 'NATIVE');
INSERT INTO records (domain_id, name, content, type,ttl,prio) 
VALUES (1,'contoh.web.id','localhost ahu@ds9a.nl 1','SOA',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'contoh.web.id','ns1.contoh.web.id','NS',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'contoh.web.id','ns1.isp.net.id','NS',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'www.contoh.web.id','192.168.0.100','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'ns1.contoh.web.id','192.168.0.100','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'mail.contoh.web.id','192.168.0.100','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'localhost.contoh.web.id','127.0.0.1','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'www.example.com','2001:470:36:ab6::100','AAAA',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'mail.example.com','2001:470:36:ab6::100','AAAA',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'localhost.example.com','::1','AAAA',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'contoh.web.id','mail.contoh.web.id','MX',120,25);
quit

Cek dari komputer lain

A

dig www.contoh.web.id @192.168.0.100
; <<>> DiG 9.9.5-3-Ubuntu <<>> www.contoh.web.id @192.168.0.100
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29449
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 2800
;; QUESTION SECTION:
;www.contoh.web.id.		IN	A

;; ANSWER SECTION:
www.contoh.web.id.	120	IN	A	192.168.0.100

;; Query time: 33 msec
;; SERVER: 192.168.0.100#53(192.168.0.100)
;; WHEN: Fri Jun 05 09:44:47 WIB 2015
;; MSG SIZE  rcvd: 62


NS

dig NS contoh.web.id @192.168.0.100
; <<>> DiG 9.9.5-3-Ubuntu <<>> NS contoh.web.id @192.168.0.100
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60961
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 2800
;; QUESTION SECTION:
;contoh.web.id.			IN	NS

;; ANSWER SECTION:
contoh.web.id.		86400	IN	NS	ns1.isp.net.id.
contoh.web.id.		86400	IN	NS	ns1.contoh.web.id.

;; ADDITIONAL SECTION:
ns1.contoh.web.id.	120	IN	A	192.168.0.100

;; Query time: 4 msec
;; SERVER: 192.168.0.100#53(192.168.0.100)
;; WHEN: Fri Jun 05 09:44:57 WIB 2015
;; MSG SIZE  rcvd: 102


MX

dig MX contoh.web.id @192.168.0.100
; <<>> DiG 9.9.5-3-Ubuntu <<>> MX contoh.web.id @192.168.0.100
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25178
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 2800
;; QUESTION SECTION:
;contoh.web.id.			IN	MX

;; ANSWER SECTION:
contoh.web.id.		120	IN	MX	25 mail.contoh.web.id.

;; ADDITIONAL SECTION:
mail.contoh.web.id.	120	IN	A	192.168.0.100

;; Query time: 3 msec
;; SERVER: 192.168.0.100#53(192.168.0.100)
;; WHEN: Fri Jun 05 09:45:02 WIB 2015
;; MSG SIZE  rcvd: 79