Penulis akan membuat domain dengan nama www.pacul.com
Langkah awal masuk ke terminal dengan akases root
Seting IP pada computer yang akan di buat server DNS
root@(none):/home/dns# nano
/etc/network/interfaces
auto
eth0
iface
eth0 inet static
address
192.168.0.101
netmask
255.255.255.248
network
192.168.0.0
gateway
192.168.0.101
root@(none):/home/dns# apt-get install bind9 bind9utils dnsutils
root@(none):/home/dns# nano /etc/bind/named.conf.default-zones
Tambahkan baris ini pada urutan paling bawah
zone "101.in-addr.arpa"{ //untuk ip
type master;
file
"/var/cache/bind/db.127dns";
};
zone "pacul.com"{ //untuk dns
type master;
file
"/var/cache/bind/db.dnslocal";
};
root@(none):/home/dns# cd /etc/bind/
root@(none):/etc/bind# ls
bind.keys db.255
db.root
named.conf.local
db.0 named.conf named.conf.options
db.127 db.empty
named.conf.default-zones
rndc.key
db.local
named.conf.default-zones.save
zones.rfc1918
copikan db
.127 menjadi db.127dns dan copikan db
.local menjadi db.dnslocal
root@(none):/etc/bind# cp db.127 db.127dns
root@(none):/etc/bind# db .local menjadi db.dnslocal
root@(none):/etc/bind# ls
bind.keys
db.255 db.root
named.conf.local
db.0 db.dnslocal
named.conf named.conf.options
db.127 db.empty
named.conf.default-zones
rndc.key
db.127dns db.local
named.conf.default-zones.save
zones.rfc1918
rubahlah bagian ini
hilangkan tanda //
root@(none):/etc/bind# nano /etc/bind/named.conf.default-zones
forwarders {
8.8.8.8;
8.8.4.4;
kemudian rubah isi dari db.127dns dan db.dnslocal
root@(none):/etc/bind# nano db.127dns
;
;
BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN
SOA pacul.com. root.localhost.
(
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN
NS pacul.com
101 IN
PTR pacul.com.
@ IN
A 192.168.0.101
root@(none):/etc/bind# nano db.dnslocal
;
;
BIND data file for local loopback interface
;
$TTL 604800
@ IN
SOA pacul.com. root.localhost.
(
2013101601 ; Serial
04800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ; Negative Cache TTL
)
@ IN
NS pacul.com.
@ IN
A 192.168.0.101
@ IN
MX 10 pacul.com
main
IN A 192.168.0.101
kemudian
copy file db.127dns dan db.dnslocal ke directory /var/cache/bind/
root@(none):/etc/bind#
cp db.127dns db.dnslocal /var/cache/bind/
setelah
semua tercopy lanjut ke konfigurasi host
isikan hosts dengan nama domain
root@(none):/etc/bind#
nano /etc/hosts
pacul.com
root@(none):/etc/bind#
nano resolv.conf
nameserver
192.168.0.101 //untuk dns local
nameserver
8.8.8.8 //untuk dns google
lalu
seting kembali untuk rc.local
masukan
script diatas exit 0
root@(none):/etc/bind#
nano /etc/rc.local
iptables
-t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
iptables
-A INPUT -m state --state NEW -p tcp -m multiport --ports 53 -j ACCEPT
iptables
-A FORWARD -p udp -m multiport --ports 53 -j ACCEPT
iptables
-A OUTPUT -p tcp -m multiport --ports 53 -j ACCEPT
iptables
-A INPUT -p udp -m multiport --ports 53 -j ACCEPT
iptables
-A FORWARD -p tcp -m multiport --ports 53 -j ACCEPT
iptables
-A OUTPUT -p udp -m multiport --ports 53 -j ACCEPT
hilangkan
tanda tagar# pada # net.ipv4.ip_forward=1
root@(none):/etc/bind# nano /etc/sysctl.conf
net.ipv4.ip_forward=1
restart untuk rc.local
root@(none):/etc/bind# /etc/init.d/rc.local start
restart untuk bind9
root@(none):/etc/bind# /etc/init.d/bind9 restart
restart untuk web service disini penulis mengunakan
ngix untuk webservinya
root@(none):/etc/bind# /etc/init.d/ngix restart
Untuk test apakah dns sudah berjalan dengan normal akan
keluar seperti ini
root@(none):/etc/bind#
dig pacul.com
;
<<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> pacul.com
;;
global options: +cmd
;;
Got answer:
;;
->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23688
;;
flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;;
QUESTION SECTION:
;pacul.com. IN A
;;
ANSWER SECTION:
pacul.com. 604800 IN
A 192.168.0.101
;;
AUTHORITY SECTION:
pacul.com. 604800 IN
NS pacul.com.
;;
Query time: 6 msec
;;
SERVER: 192.168.0.101#53(192.168.0.101)
;;
WHEN: Thu Apr 23 02:24:45 2015
;;
MSG SIZE rcvd: 57
root@(none):/etc/bind#
ping pacul.com
64
bytes from pacul.com (192.168.0.101): icmp_req=1 ttl=64 time=0.419 ms
64
bytes from pacul.com (192.168.0.101): icmp_req=2 ttl=64 time=0.025 ms
64
bytes from pacul.com (192.168.0.101): icmp_req=3 ttl=64 time=0.025 ms
Test
pada computer client windows
Seting
IP pada network windows pastikan DNS Primay diisi dengan ip dns 192.168.0.101
Connection-specific
DNS Suffix:
Description:
MAC Bridge Miniport
Physical
Address: 02-00-00-00-00-00
DHCP
Enabled: Yes
IPv4
Address: 192.168.0.100
IPv4
Subnet Mask: 255.255.255.0
Lease
Obtained: Thursday, April 23, 2015 12:16:43 PM
Lease
Expires: Thursday, April 23, 2015 3:31:08 PM
IPv4
Default Gateway: 192.168.0.1
IPv4
DHCP Server: 192.168.0.1
IPv4 DNS Servers: 192.168.0.101, 8.8.4.4
IPv4
WINS Server:
NetBIOS
over Tcpip Enabled: Yes
Link-local
IPv6 Address: fe80::edbf:7388:da1d:86e1%15
IPv6
Default Gateway:
IPv6
DNS Server:
C :\Users\fendhy>ping
pacul.com
Pinging
pacul.com [69.56.147.4] with 32 bytes of data:
Reply
from 69.56.147.4: bytes=32 time=281ms TTL=46
Reply
from 69.56.147.4: bytes=32 time=292ms TTL=46
Reply
from 69.56.147.4: bytes=32 time=299ms TTL=46
Reply
from 69.56.147.4: bytes=32 time=278ms TTL=46
Ping
statistics for 69.56.147.4:
Packets: Sent = 4, Received = 4, Lost = 0
(0% loss),
Approximate
round trip times in milli-seconds:
Minimum = 278ms, Maximum = 299ms, Average =
287ms
Test pada browser windows www.pacul.com
Sekian dan terima kasih semoga bermanfaat
email:penkwalker@gmail.com