KIOSS UNDIP

Komunitas Open Source Software Universitas Diponegoro

Tips Mempercepat koneksi dengan Caching DNS

| 0 comments

Pada tutorial kali ini, coba saya share bagaimana mempercepat resolv ke suatu domain menjadi lebih cepat dengan menggunakan DNSMASQ, kenapa bisa jadi lebih cepat ? karena setiap query ke suatu domain akan di cache ke dalam lokal komputer.

ok kita mulai saja :

1. Instal dnsmasq

apt-get install dnsmasq

2. konfigurasi file /etc/dnsmasq.conf sebagai berikut :

# Never forward plain names (without a dot or domain part)

domain-needed

# Never forward addresses in the non-routed address spaces.

bogus-priv

#resolv ke DNS upstream

resolv-file=/etc/resolv-senopati.conf

# Add local-only domains here, queries in these domains are answered

# from /etc/hosts or DHCP only.

local=/localnet/

# Set the cachesize here.

cache-size=10000

# If you want to disable negative caching, uncomment this.

no-negcache

neg-ttl=3600

3. Buat file /etc/resolv-senopati.conf ( nama file terserah sesuai path yg kita set di /etc/dnsmasq.conf)

nameserver 182.255.0.37

nameserver 182.255.2.37

Atau bisa menggunakan DNS GOOGLE maupun OPENDNS

4. Edit file /etc/resolv.com

nameserver 127.0.0.1

5. selesai dan restart service DNSMASQ

/etc/init.d/dnsmasq restart

 

Berikut contoh hasil pengujian :

PENGUJIAN I :

root@mazamry-MacBookPro:/etc/apt# dig youtube.com

; <<>> DiG 9.8.1-P1 <<>> youtube.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50318
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;youtube.com. IN A

;; ANSWER SECTION:
youtube.com. 52 IN A 173.194.38.162
youtube.com. 52 IN A 173.194.38.163
youtube.com. 52 IN A 173.194.38.164
youtube.com. 52 IN A 173.194.38.165
youtube.com. 52 IN A 173.194.38.166
youtube.com. 52 IN A 173.194.38.167
youtube.com. 52 IN A 173.194.38.168
youtube.com. 52 IN A 173.194.38.169
youtube.com. 52 IN A 173.194.38.174
youtube.com. 52 IN A 173.194.38.160
youtube.com. 52 IN A 173.194.38.161

;; AUTHORITY SECTION:
youtube.com. 45461 IN NS ns2.google.com.
youtube.com. 45461 IN NS ns1.google.com.
youtube.com. 45461 IN NS ns3.google.com.
youtube.com. 45461 IN NS ns4.google.com.

;; ADDITIONAL SECTION:
ns1.google.com. 85901 IN A 216.239.32.10
ns2.google.com. 84635 IN A 216.239.34.10
ns3.google.com. 84635 IN A 216.239.36.10
ns4.google.com. 84635 IN A 216.239.38.10

;; Query time: 18 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Oct 19 16:14:40 2012
;; MSG SIZE rcvd: 348

PENGUJIAN II :

root@mazamry-MacBookPro:/etc/apt# dig youtube.com

; <<>> DiG 9.8.1-P1 <<>> youtube.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64762
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;youtube.com. IN A

;; ANSWER SECTION:
youtube.com. 49 IN A 173.194.38.161
youtube.com. 49 IN A 173.194.38.160
youtube.com. 49 IN A 173.194.38.174
youtube.com. 49 IN A 173.194.38.169
youtube.com. 49 IN A 173.194.38.168
youtube.com. 49 IN A 173.194.38.167
youtube.com. 49 IN A 173.194.38.166
youtube.com. 49 IN A 173.194.38.165
youtube.com. 49 IN A 173.194.38.164
youtube.com. 49 IN A 173.194.38.163
youtube.com. 49 IN A 173.194.38.162

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Oct 19 16:14:43 2012
;; MSG SIZE rcvd: 205

NB: terlihar hasil pengujian query time dari 18 msec menjadi 0 msec

Author: MazAmry

OB yang sehari-harinya ngepel, nyapu, dsb ... oprec ini-itu untuk kepentingan hajat orang banyak ( maaf agak lebay :D )

Leave a Reply