PowerDNS: Memasukan Record

From OnnoWiki
Jump to navigation Jump to search

Masuk ke SQL Server

mysql -u root -p123456

Gunakan Database PowerDNS misalnya

use powerdns;

Contoh membuat Domain / Zone

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

Contoh membuat Record SOA

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

Contoh membuat Record 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);

Contoh membuat Record 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);

Contoh membuat Record 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); 

Contoh membuat Record MX

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

Contoh memasukan Sebuah Domain Sekaligus

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.contoh.web.id','2001:470:36:ab6::100','AAAA',120,NULL); 
INSERT INTO records (domain_id, name, content, type,ttl,prio) 
VALUES (1,'mail.contoh.web.id','2001:470:36:ab6::100','AAAA',120,NULL); 
INSERT INTO records (domain_id, name, content, type,ttl,prio) 
VALUES (1,'localhost.contoh.web.id','::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

Kita dapat cek menggunakan dig ke IPv6 DNS, misalnya ke localhost ( ::1 )

dig MX contoh.web.id @::1

Hasilnya kira-kira

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

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1680
;; 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	AAAA	2001:470:36:ab6::100
mail.contoh.web.id.	120	IN	A	192.168.0.100

;; Query time: 2 msec
;; SERVER: ::1#53(::1)
;; WHEN: Wed Feb 20 02:51:22 UTC 2019
;; MSG SIZE  rcvd: 107


Pranala Menarik