Oct 092008
 

YouTube is a video-sharing website on which users can upload, share, and view videos, created by three former PayPal employees in February 2005. The company is based in San Bruno, California, and uses Adobe Flash Video and HTML5[4] technology to display a wide variety of user-generated video content, including movie clips, TV clips, and music videos, as well as amateur content such as video blogging and short original videos. Most of the content on YouTube has been uploaded by individuals, although media corporations including CBS, BBC, Vevo, Hulu and other organizations offer some of their material via the site, as part of the YouTube partnership program.

Nerusin topik sebelumnya , setelah berhasil bikin proxy pakai squid di winxp, akan di coba nambahin local resolver dns pakai bind9(windows precompile binary).

step pertama, nginstall bind9 di winxp
download precompile bind9 untuk windows di sini:

http://ftp.isc.org/isc/bind9/9.5.0-P2-W2/BIND9.5.0-P2-W2.zip

  • extrak di satu folder.
  • didalam folder klik 2 kali BINDInstall
  • muncul popup windows installer kecil, biarkan semua nya default, kecuali service account password,klik install

tunggu sampai selesai.

hasil instalasi nya nanti akan berada di sini C:\WINDOWS\system32\dns

  • klik start -> run -> ketik cmd, cd ke C:\WINDOWS\system32\dns\etc\

– buat file dengan nama named.conf,isinya seperti ini:

acl "trusted" {
     localhost;
     192.168.0.0/16;
};

acl "bogusips" {
     0.0.0.0/8;
     1.0.0.0/8;
     2.0.0.0/8;
     192.0.2.0/24;
     224.0.0.0/3;
     169.254.0.0/16;
};

options {
   allow-transfer { none; };
   allow-query { trusted; };
   allow-recursion { trusted; };
   blackhole { bogusips; };
   directory "c:\windows\system32\dns\etc";
   listen-on { 127.0.0.1;  }; #listen only on localhost
   forwarders { 202.x.x.x; 202.x.x.x; }; #ubah sesuai dns isp masing2
   forward first;
   recursion yes;
};

logging {
   channel queries_log {
       file "c:\windows\system32\dns\etc\queries.log";
       print-severity yes;
       print-time yes;
   };
   category queries { queries_log ; };
};

zone "." {
   type hint;
   file "named.root";
};

zone "localhost." IN {
   type master;
   file "localhost.zone";
   allow-update { none; };
};

zone "0.0.127.in-addr.arpa." IN {
   type master;
   file "localhost.rev";
   allow-update { none; };
};

include "d:\windows\system32\dns\etc\rndc.key";

– masih di directory C:\WINDOWS\system32\dns\etc\

ketik ..\bin\dig.exe @a.root-servers.net . ns > named.root
perintah di atas akan menghasilkan file named.root yg berisi record2 root zone

ketik ..\bin\rndc-confgen.exe -a
perintah di atas akan menghasilkan file rndc.key

ketik copy con localhost.zone , tekan enter, kemudian paste isi zone file ini:

$TTL 86400
@ IN SOA @ root (
       42 ; serial
       3H ; refresh
       15M ; retry
       1W ; expiry
       1D ) ; minimum
IN NS @
IN A 127.0.0.1

tekan tombol ctrl+z

ketik copy con localhost.rev , tekan enter, kemudian paste isi zone file ini:

$TTL 86400
@ IN SOA localhost. root.localhost. (
       1997022700 ; Serial
       28800 ; Refresh
       14400 ; Retry
       3600000 ; Expire
       86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.

tekan tombol ctrl+z

– untuk memastikan konfigurasinya sudah benar nggak ada error ketik ini:

..\bin\named-checkconf.exe , kalo gakkeluar warning atau apapun bisa kita asumsikan konfig nyaudah benar.

– saat nya jalanin service bind9, klik start-> run->ketik services.msc->enter, nanti keluar jendela services, cari service yg bernama ISC BIND, select, klik kanan, start.

– setingan ethernet/tcp/ip untuk dns nya jangan lupa di ubah ganti dengan localhost atau 127.0.0.1

sudah siap untuk di coba.

contoh:

ketik ..\bin\dig.exe @127.0.0.1 www.altavista.com ns

hasil output query:

; <<>> DiG 9.5.0-P2-W2 <<>> @127.0.0.1 www.altavista.com ns
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1218
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;www.altavista.com.             IN      NS

;; ANSWER SECTION:
www.altavista.com.      287     IN      CNAME   avatw.search.yahoo2.akadns.net.

;; AUTHORITY SECTION:
akadns.net.             10      IN      SOA     internal.akadns.net. hostmaster.
akamai.com. 1223533604 90000 90000 90000 180

;; Query time: 109 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Oct 09 13:26:35 2008
;; MSG SIZE  rcvd: 142

query timenya 109 msec

ketik lagi ..\bin\dig.exe @127.0.0.1 www.altavista.com ns

hasil ouput nya:

; <<>> DiG 9.5.0-P2-W2 <<>> @127.0.0.1 www.altavista.com ns
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1047
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;www.altavista.com.             IN      NS

;; ANSWER SECTION:
www.altavista.com.      165     IN      CNAME   avatw.search.yahoo2.akadns.net.

;; AUTHORITY SECTION:
akadns.net.             5       IN      SOA     internal.akadns.net. hostmaster.
akamai.com. 1223533721 90000 90000 90000 180

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Oct 09 13:28:37 2008
;; MSG SIZE  rcvd: 142

kali ini hasil querynya 0 msec, sepertinya resolver kita sudah berhasil meng-cache hasil query dns

nah, karena niat kita dari pertama mau semua yg harusnya keluar ke internet di cache di lokal pc atau laptop kita, sekarang tinggal ngubah sedikit config squid supaya memakai lokal dns resolver yg baru kita buat, gampang kok tinggal ngedit TAG dns_nameservers

dns_nameservers 127.0.0.1 # cuma ini aja yg harus di edit

selesai.

step selanjutnya bikin caching youtube

(note: butuh squid versi 2.7 versi lain setau saya nggak bisa karena nggak ada fungsi storeurl_rewrite_program, storeurl_access)

referensi nya saya dapet dari sini:

http://human.network.web.id/2008/06/30/caching-youtube/

( tutorial yg hebat , tutorialnya aslinya buat proxy under linux(penulis juga sudah coba di linux dan berhasil)

sekarang kita akan coba install di winxp

langkah2nya:

karena script untuk me-rewrite url yg kita gunakan berbasis kan perl interpreter kita butuh nginstall interpreter nya, gak masalah download aja di sini:

http://www.activestate.com/Products/activeperl/index.mhtml

install, ikutin aja step2 default nya.

setelah itu masuk ke directory config dimana kita menginstall squid

cd c:\squid\etc\

buat file store_url_rewrite.pl

copy con store_url_rewrite.pl , ketik enter lalu isi data2 ini

#!/perl/bin/perl
$|=1;
while (<>) {
@X = split;
$url = $X[0];
$url =~s@^http://(.*?)/get_video\?(.*)video_id=(.*?)&.*@squid://videos.youtube.INTERNAL/ID=$3@;
$url =~s@^http://(.*?)/get_video\?(.*)video_id=(.*?)$@squid://videos.youtube.INTERNAL/ID=$3@;
$url =~s@^http://(.*?)/videodownload\?(.*)docid=(.*?)$@squid://videos.google.INTERNAL/ID=$3@;
$url =~s@^http://(.*?)/videodownload\?(.*)docid=(.*?)&.*@squid://videos.google.INTERNAL/ID=$3@;
$url =~s@^http://(.*?)/albums\?&.*@squid://images.photobucket.INTERNAL/ID=$3@;
$url =~s@^http://(.*?)/albums\?$@squid://images.photobucket.INTERNAL/ID=$3@;
$url =~s@^http://(.*?)/albums\?&.*@squid://videos.photobucket.INTERNAL/ID=$3@;
$url =~s@^http://(.*?)/albums\?$@squid://videos.photobucket.INTERNAL/ID=$3@;
print "$url\n"; }

tekan ctrl+z

untuk konfig squidnya, squid.conf contoh aja seperti di bawah ini, edit2 sesuai kebutuhan

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl our_networks src 202.127.96.0/20 202.123.224.0/20 210.79.208.0/20

acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
acl localnet src 172.16.0.0/12    # RFC1918 possible internal network
acl localnet src 192.168.0.0/16    # RFC1918 possible internal network
acl localnet src 172.34.52.75/32
acl SSL_ports port 443
acl Safe_ports port 80        # http
acl Safe_ports port 21        # ftp
acl Safe_ports port 443        # https
acl Safe_ports port 70        # gopher
acl Safe_ports port 210        # wais
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280        # http-mgmt
acl Safe_ports port 488        # gss-http
acl Safe_ports port 591        # filemaker
acl Safe_ports port 777        # multiling http
acl CONNECT method CONNECT
acl YMPort port 5050        # Yahoo messenger
acl PURGE method purge
http_access allow purge localhost
http_access deny purge
http_access allow CONNECT YMPort localnet
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow our_networks
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128
hierarchy_stoplist cgi-bin ?
cache_mem 6 MB
maximum_object_size_in_memory 32 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
cache_dir aufs c:/squid/var/cache 5000 16 256
maximum_object_size 128 MB
cache_swap_low 98
cache_swap_high 99
cache_dir aufs c:/squid/var/cache 5000 16 256
cache_access_log c:/squid/var/logs/access.log
cache_store_log c:/squid/var/logs/store.log
cache_log c:/squid/var/logs/cache.log
dns_nameservers 127.0.0.1
log_fqdn off
storeurl_rewrite_program c:/perl/bin/perl.exe c:/squid/etc/store_url_rewrite.pl
acl store_rewrite_list url_regex ^http://(.*?)/get_video\?
acl store_rewrite_list url_regex ^http://(.*?)/videodownload\?
acl store_rewrite_list url_regex ^http://i(.*?).photobucket.com/albums/(.*?)/(.*?)/(.*?)\?
acl store_rewrite_list url_regex ^http://vid(.*?).photobucket.com/albums/(.*?)/(.*?)\?
storeurl_access allow store_rewrite_list
storeurl_access deny all
cache allow store_rewrite_list
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
refresh_pattern ^http://(.*?)/get_video\? 10080 90% 999999 override-expire ignore-no-cache ignore-private
refresh_pattern ^http://(.*?)/videodownload\? 10080 90% 999999 override-expire ignore-no-cache ignore-private
refresh_pattern ^http://i(.*?).photobucket.com/albums/(.*?)/(.*?)/(.*?)\? 43200 90% 999999 override-expire ignore-no-cache ignore-private
refresh_pattern ^http://vid(.*?).photobucket.com/albums/(.*?)/(.*?)\? 43200 90% 999999 override-expire ignore-no-cache ignore-private
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern .        0    20%    4320
quick_abort_min 0
quick_abort_max 0
quick_abort_pct 98
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
vary_ignore_expire on
cache_effective_user squid
cache_effective_group squid
log_icp_queries off
ipcache_size 2048
ipcache_low 98
ipcache_high 99
memory_pools off
reload_into_ims on
pipeline_prefetch on
cachemgr_passwd xxxxxx  all

jangan lupa di save

setelah itu klik start->run->services.msc, rstart services squid

terakhir test browsing salah satu video youtube, untuk pertama kali memang masih di stream langsung dari server youtube.

tutup browser, buka kembali dan arahkan ke url video yg sama di youtube. kalo proses cachingnya berhasil, menurut pengamatan penulis proses load nya sudah dari lokal cache/disk

selesai semua usaha kita untuk mengcaching yg seharus nya kita load directly dari server nya di internet

  30 Responses to “speedy quota 1G + winxp(laptop) + squid + bind9 + cache youtube (lanjutan)”

Comments (30)
  1. BRO…. PLEASE HELP

    PADA STEP YG PERTAMA TERUS SAYA CEK : dig.exe @127.0.0.1 http://www.altavista.com ns

    MUNCUL :

    ; <> DiG 9.5.0-P2-W2 <> @127.0.0.1 http://www.altavista.com ns
    ; (1 server found)
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 620
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

    ;; QUESTION SECTION:
    ;www.altavista.com. IN NS

    ;; Query time: 0 msec
    ;; SERVER: 127.0.0.1#53(127.0.0.1)
    ;; WHEN: Mon Jun 06 18:23:05 2011
    ;; MSG SIZE rcvd: 35

    KENAPA KOK GITU ?

    NAMED CONF NYA :

    cl "trusted" {
    localhost;
    192.168.0.0/16;
    };

    acl "bogusips" {
    0.0.0.0/8;
    1.0.0.0/8;
    2.0.0.0/8;
    192.0.2.0/24;
    224.0.0.0/3;
    169.254.0.0/16;
    };

    options {
    allow-transfer { none; };
    allow-query { trusted; };
    allow-recursion { trusted; };
    blackhole { bogusips; };
    directory "c:\windows\system32\dns\etc";
    listen-on { 127.0.0.1; }; #listen only on localhost
    forwarders { 202.134.1.10; 202.134.0.155; }; #ubah sesuai dns isp masing2
    forward first;
    recursion yes;
    };

    logging {
    channel queries_log {
    file "c:\windows\system32\dns\etc\queries.log";
    print-severity yes;
    print-time yes;
    };
    category queries { queries_log ; };
    };

    zone "." {
    type hint;
    file "named.root";
    };

    zone "localhost." IN {
    type master;
    file "localhost.zone";
    allow-update { none; };
    };

    zone "0.0.127.in-addr.arpa." IN {
    type master;
    file "localhost.rev";
    allow-update { none; };
    };

    include "c:\windows\system32\dns\etc\rndc.key";

    HP. 085735874309 / Soalnya penasaran nih

  2. bind nya sudah di pastikan jalan belum bro?
    liat prosesnya lewat cmd atau taskmanager

    tasklist | findstr named
    

    format dig yang benar seperti ini bro:

    dig.exe @127.0.0.1 altavista.com ns
    

    nggak pakai http://www. , karena yang kita query nameserver top level domainnya.

    mungkin bisa di coba dulu

  3. Waaaah….. Malah di SATART Service nya ndak bisa.. JADI eror Bro.. dah tak masukin user name and Log on nya bener tetep ndak bisa…..

  4. errornya apa? mungkin dari error nanti ketahuan salahnya dimana

  5. EROR 1069 : The service dis not start due to al ogon failure.

    Padahal sudah bener Tak masukin user name Dan Password nya.. di pengaturan Properties Logon.

    klo tak buat local system logon.. : Malah Terminated.. ndak bisa di Buka.. Settingan konfigurasi sudah Bener..

    kenapa Ya ?

  6. EROR 1069 : THE SERVICE DID NOT START DUE TO A LOGON FAILURE

    padahal user name dan pasword sudah bener..

  7. maksudnya logon di services nya?

  8. settingan logon saya di services seperti ini:
    bind services

  9. masih bisa kah skarang ??

    udah ku coba tapi squid.conf nya yang bingung….

    bisa liat squid.conf kamu gk ?

    pliss buat contoh aja….

  10. sepertinya sudah gak bisa, saya males maintainnya hehe

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*