squidNT အကြောင်းသိကောင်းစရာ

Windows ပေါ်မှာ Internet sharing လုပ်ဖို့အတွက် softwareတွေ အများအပြားရှိပါတယ်။ ISA Server,Forefront TMG, Winroute, Allegrosurf, ccProxy စတာတွေကလည်း သူ့အားသာချက်နဲ့သူ ကောင်းကြပါတယ်။ Linux ပေါ်မှာဆိုရင်တော့ squid က တော်တော် နာမည်ကြီးပါတယ်။ squid က windows platform ပေါ်မှာလည်း အတိုင်းအတာတစ်ခုအထိ support လုပ်ပါတယ်။ အဲဒါကို squidNT လို့ခေါ်ပါတယ်။ squidNT ကိုဘယ်လို install လုပ်တယ်၊ ဘယ်လို configuration တွေ လုပ်တယ်ဆိုတာကို စမ်းကြည့်ကြရအောင်။ ဒီနေရာမှာ တစ်ခု ကြိုပြောထားချင်တာက ကျွန်တော်က squid ကျွမ်းကျင်သူ မဟုတ်သလို  Networking ကျွမ်းကျင်သူလည်း မဟုတ်ပါဘူး။ အဲဒီတော့ ကျွန်တော် လုပ်တဲ့ အဆင့်တွေ ၊ command တွေက လွဲကောင်း လွဲနိုင်ပါတယ်။

ပထမဆုံး ကျွန်တော်တို့ လုပ်ရမှာက squidNT ကို အင်တာနက်ကနေ ဒေါင်းလုပ်ဆွဲဖို့ပါ။ squid က opensource ဖြစ်တာကြောင့် သူ့ code တွေကို ကိုယ်တိုင် compile လုပ်ပြီး run လို့ရသလို၊ လွယ်ကူအောင် binary packages တွေလည်း ထုတ်ပေးထားပါတယ်။ squidNT အတွက် binary package ကို

http://squid.acmeconsulting.it/download/squid-2.7.STABLE8-bin.zip

ကနေ ဒေါင်းလုပ် ရယူနိုင်ပါတယ်။ squidNT ဗားရှင်းတွေ အမျိုးမျိုးရှိပေမယ့် အခု squid 2.7 stable 8 ကတော့ ထွက်တာမကြာသေးပါဘူး။ ဒေါင်းလုပ် ပြီးသွားရင်တော့ zip ကို c:\ အောက်မှာ ဖြည်ချလိုက်ပါ။ squidNT က windowsXP,Windows Vista,Windows Server 2003 ပေါ်မှာ အလုပ်လုပ်နိုင်တယ်လို့ ရေးထားပေမယ့် ကျွန်တော် စမ်းကြည့်ရသလောက် windows server 2008 ပေါ်မှာလည်း အလုပ်လုပ်ပါတယ် (UAC, Windows Firewall ကိုတော ့ပိတ်ပေးရပါတယ်)။ c:\ အောက်မှာ squid ကိုဖြည်ချပြီးသွားရင်တော့ c:\squid\etc အောက်မှာရှိတဲ့ file ၄ ခုကို rename ပြင်ပေးရပါမယ်။

  • cachemgr.conf.default,
  • mime.conf.default,
  • squid.conf.default,
  • squid_radius_auth.conf.default

အဲဒီဖိုင်၄ဖိုင်ရဲ ့ အနောက်က .default ကိုဖျက်လိုက်ပါ။

  • cachemgr.conf,
  • mime.conf,
  • squid.conf,
  • squid_radius.auth.conf

အဲဒီလိုပြောင်းသွားမှာပါ။ squid မှာ တစ်ခု သဘောကျဖို့ ကောင်းတာက configuration based ပုံစံမျိုးပါ။ (linux ရဲ့ သဘောသဘာဝလို့လည်း ပြောနိုင်ပါတယ်)။ အခုလည်း squid မှာ အဓိက ကျတဲ့ squid.conf မှာ ကိုယ်လိုချင်တာတွေ ရေးထည့်လိုက်ရုံပါပဲ။ squid.conf ကို notepad(ကိုယ်ကြိုက်တဲ့ text editor) နဲ့ဖွင့်ပါ။ ပြီးရင် select all ပေးပြီးတော့ အကုန် delete လုပ်လိုက်ပါ။ (တစ်ချို့ကတော့ အဲဒီလို အကုန် ဖျက်လိုက်တာကို သဘောမကျပါဘူး။ ကျွန်တော်ကတော့ minimum configuration လုပ်ရတာကို သဘောကျလို့ ဖျက်ပစ်တာပါ)။ ပြီးရင်တော့ အောက်မှာ ရေးထားတာတွေကို copy ကူးပြီးတော့ squid.conf ထဲမှာ paste လုပ်လိုက်ပါ။

hierarchy_stoplist cgi-bin ?

acl QUERY urlpath_regex cgi-bin \?

no_cache deny QUERY

auth_param basic children 15

auth_param basic realm Squid  proxy-caching web server

auth_param  basic credentialsttl 2 hours

auth_param basic casesensitive off

refresh_pattern ^ftp:  1440 20% 10080

refresh_pattern ^gopher: 1440 0% 1440

refresh_pattern .  0 20% 4320

acl all src  0.0.0.0/0.0.0.0

acl manager proto  cache_object

acl localhost src  127.0.0.1/255.255.255.255

acl lan src 192.168.1.1-192.168.1.255

acl SSL_ports port 443 563 5222

acl Safe_ports  port 80  # http

acl  Safe_ports port 21  # ftp

acl  Safe_ports port 443 563 # https, snews

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

pid_filename  c:/squid/var/logs/squid.pid

cache_dir ufs  c:/squid/var/cache 1000 16 256

cache_log  c:/squid/var/logs/cache.log

cache_store_log  c:/squid/var/logs/store.log

http_access  allow manager localhost

http_access allow manager lan

http_access  deny manager

http_access deny !Safe_ports

http_access  deny CONNECT !SSL_ports

http_access allow localhost

http_access  allow lan

http_access deny all

http_reply_access  allow all

icp_access allow all

http_port  8080

cache_peer 203.81.72.200 parent 8080 0

never_direct  allow all

အပေါ်က squid.conf မှာ ပြင်စရာ ၂ နေရာပါပါတယ်။ ပထမ တစ်နေရာက

acl lan src 192.168.1.1-192.168.1.255

အဲဒီနေရာမှာ ကျွန်တော်က 192.168.1.1-192.168.1.255 ကို လူသုံး အများဆုံးဖြစ်တဲ့ (သုံးနေကျ) local network ip ကို ထည့်ထားတာပါ။ ကိုယ့် LAN IP range ကို ပြောင်းလိုက်ရုံပါပဲ။ နောက်တစ်နေရာက

cache_peer 203.81.72.200 parent 8080

အဲဒီနေရာမှာလည်း 203.81.72.200 ဆိုတာ MPT ADSL အတွက် upstream proxy ကိုထည့်ထားတာပါ။ ကိုယ်သုံးတဲ့ ISP ရဲ့ upstream proxy server ကိုထည့်လိုက်ရုံပါပဲ။ direct connection(no proxy) သုံးတဲ့ သူတွေအတွက်ကတော့ cache_peer…, never_direct… အဲဒီ ၂ ကြောင်းကို ထည့်ပေးစရာ မလိုပါဘူး။ အဲဒီနေရာတွေ ပြင်ပြီးသွားရင်တော့ save လုပ်ပြီး squid.conf ကို ပိတ်လိုက်ပါ။

နောက်ကျန်တဲ့ အဆင့်တွေက cache directory ဆောက်တာနဲ့ squid ကို windows service အဖြစ် ပြောင်းပေးဖို့ရယ်ပါ။ run ထဲကနေ cmd လို့ရိုက်ပြီးတော့ command prompt ကိုခေါ်လိုက်ပါ။ ပြီးရင်တော့ command prompt ထဲမှာ cd\  လို့ရိုက်ပြီး enter ခေါ်လိုက်ပါ။ အဲဒီအဆင့်ပြီးရင်တော့ squid command တွေကို အဓိက အလုပ်လုပ်ပေးတဲ့ squid.exe ရှိတဲ့ လမ်းအကြောင်းကို သွားရမှာပါ။ အဲဒါကလည်း command prompt ထဲမှာ cd squid\sbin လို့ရိုက်ပြီး enter နှိပ်လိုက်ရုံပါပဲ။ ကိုယ့်ရဲ ့ command prompt ထဲမှာ c:\squid\sbin>_ လို့ ပေါ်လာရင်တော့ အဆင်သင့်ဖြစ်ပါပြီ။

Cache directory ဆောက်ဖို့အတွက် command prompt ထဲမှာ squid -z လို့ရိုက်လိုက်ပါ။ c:\squid\sbin>squid -z (ဒီလိုပုံစံဖြစ်နေမှာပါ)။ command prompt ထဲမှာ creating swap directories .. ဘာညာဆိုပြီး ပေါ်လာတယ် ဆိုရင်တော့ cache directory ဆောက်လို့ ပြီးသွားပါပြီ။ web proxy တွေနဲ့ Hardware router တွေ အဓိက ကွာခြားသွားတာ ဒီနေရာလို့ ထင်ပါတယ်။ web proxy တွေက ကြည့်ပြီးသား web page တွေကို cache အနေနဲ့ သိမ်းထားပေးလို့ပါ။ (အဲဒီလို သိမ်းထားဖို့လည်း မှန်ကန်တဲ့ configuration တွေကို squid.conf ထဲမှာ ရေးရမှာပါ။ အပေါ်ကပေးထားတဲ့ configuration ကတော့ cache အတွက် default setting တွေပါပဲ)။

နောက်တစ်ဆင့်ကတော့ squid ကို windows service အဖြစ်ပြောင်းလဲဖို့ပါ။ command prompt ထဲမှာ squid -i ဆိုပြီး ရိုက်လိုက်ပါ။ c:\squid\sbin>squid -i (ဒီလိုပုံစံ ဖြစ်နေမှာပါ)။ အဲဒါ ဆိုရင်တော့ squid က windows service အနေနဲ့ စက်ဖွင့်တိုင်း ဖွင့်တိုင်း သူ့ဟာသူ အလုပ်လုပ် ပေးပါလိမ့်မယ်။ run ထဲကနေ services.msc လို့ရိုက်ထည့်ပြီး ကိုယ့် squid service ရ ဲ့ status ကိုကြည့်လို့ရပါတယ်။ တကယ်လို့ service က stop ဖြစ်နေရင်တော့ start လုပ်ပေးဖို့လိုပါလိမ့်မယ်။ squid service start လုပ်တိုင်း dns ကို စစ်တဲ့အတွက် ကိုယ့် ISP ရ ဲ့ dns က ပုံမှန်အလုပ်မလုပ်နေဘူးဆိုရင် service failed ဖြစ်နေပါလိမ့်မယ်။ အဲဒီအတွက်လည်း dns test ကိုမလုပ်ဖို့ command တွေ ရှိပြီးသားပါ။ squid -O -D လို့ရိုက်ထည့် လိုက်ပါ။ အဲဒီ command က dns test ကို မစစ်ဘူးဆိုတာကို registry ထဲမှာ တခါတည်း သိမ်းထားမှာပါ။

အပေါ်က အဆင့်တွေ အားလုံး အောင်မြင်သွားပြီဆိုရင်တော့ squid ကို စမ်းကြည့် လို့ရပါပြီ။ LAN ချိတ်ဆက်ထားတဲ့ တခြား စက်တစ်လုံးရဲ ့ browser proxy setting မှာ HTTP Proxy နေရာမှာ squid တင်ထားတဲ့ စက်ရဲ ့ အိုင်ပီ ကိုထည့်ပေးပါ။ port နေရာမှာတော့ 8080 ကိုထည့်ပေးပါ။ ဒါဆိုရင်တော့ LAN ချိတ်ထားတဲ့ အခြား စက်တွေမှာလည်း အင်တာနက်သုံးလို့ ရသွားပါလိ်မ့်မယ်။ အခါအခွင့် သင့်ရင်တော့ Saudi proxy ( Open proxy) တွေနဲ့ squid ဘယ်လို တွဲဖက် အသုံးပြုတယ် ဆိုတာရယ်၊ စက်တစ်လုံးထဲမှာပဲ squid service တွေပွားပြီးတော့ အင်တာနက်လိုင်း တွေကို ဘယ်လို ပေါင်းမလဲ ဆိုတာ ရေးပေးပါအုံးမယ်။

Facebook comments:

16 Responses

  1. SquidNT ကတော့ ဟုတ်ပြီဗျို့ ဖြစ်နိုင်ရင် ISA Server Configuration လေး ရေးပေးပါဦးဗျို့

  2. SMA says:

    အကိုရေ browser setting မှာဘာမှမထဲ့ဘဲ Transparent proxy နဲ့ ရောသုံးလို့ရလားအကို?

  3. KyawZwar says:

    @SMA
    Browser ရဲ ့ proxy setting မှာ squid တင်ထားတဲ့စက်ရဲ ့ IP ရော ၊ Port ရော ၂ ခု စလုံးထည့်ပေးမှ ရပါမယ်။

  4. prettykid says:

    squid.conf မှာ ပြင်ပြီးသွားပြီ ခင်ဗျ… squid swap directories ဆောက်တာ မရဘူးခင်ဗျ
    c:\squid\sbin> squid -z
    FATAL: Bungled squid.conf line 19: refresh_pattern 0 20% 4320
    Squid Cache : Terminated abnormally.
    ဆိုတာပေါ်လာတယ် ဘယ်နေရာ မှားနေလဲ မသိဘူး ကျွန်တော် တင်ထားတာ server 2003 ပေါ်မှာပါ

  5. ကို Kyaw Zwar ရေ။ ကျေးဇူးတင်ပါတယ်ခင်ဗျာ။ ကျနော်တိုင်ပတ်နေတာခုမှပဲရှင်းသွားတော့တယ်အစ်ကို။
    အစ်ကို ့ပိုစ့်အသစ်ကိုမျှော်နေပါတယ်အစ်ကို ။ပြီးတော့တစ်ခုလည်းမေးချင်ပါသေးတယ်ခင်ဗျာ Squid ထဲမှာ အင်တာနက်လိုင်းတွေကိုပေါင်းပြီး Load Balancing လုပ်လို ့ရပါသလားအစ်ကို။
    ရရင်တစ်ချက်လောက်ရှင်းပြပေးစေချင်ပါတယ်

    ကျေးဇူးတင်ပါတယ်ခင်ဗျာ။

  6. တင့်ခိုင် says:

    ကိုကျော်စွာ ရေ squid ကို ubuntu မှာသုံးချင်လို့ configuration လေးပြောပြပါအအုံးနော်

  7. deep471@gmail.com says:

    ဟုတ်ပါ့ဗျာ ကျွန်တော်လဲအဲသည်အတိုင်းပေါ်နေတယ်။

  8. ကိုထွဋ် says:

    c:\squid\sbin> squid -z
    FATAL: Bungled squid.conf line 19: refresh_pattern 0 20% 4320
    Squid Cache : Terminated abnormally.

    လိုင်း ၁၉ မှာ error တက်နေတယ်လို့ပြောတာပါ

    refresh_pattern . 0 20 % 4320 ပါ

    . ကျန်ခဲ့တာလား ?

  9. Zarni says:

    အကိုတို့ ကျွန်တော့အထင် အဲဒီ error က squid.conf ထဲမှာ
    02,03,……… ,85 တွေ ပါနေလို့ ဖြစ်နေတယ်ထင်တယ်။
    အဲဒါတွေဖြုတ်ပီး စမ်းကြည့်ပါ
    ကျွန်တော် လုပ်တာတော့ အဆင်ပြေတယ်

  10. zawmgmg says:

    Saudi proxy ( Open proxy) တွေနဲ့ squid ဘယ်လို တွဲဖက် အသုံးပြုတယ် ဆိုတာရယ်၊ စက်တစ်လုံးထဲမှာပဲ squid service တွေပွားပြီးတော့ အင်တာနက်လိုင်း တွေကို ဘယ်လို ပေါင်းမလဲ ဆိုတာ ရေးပေးပါအုံး။

  11. zawmgmg says:

    အကိုရေ.

    squid proxy မှာ direct proxy နဲ့ တခြား proxy တွေပေါင်းတာလေးပြောပြပေးပါလား
    ADSL bagan net က direct proxy က ထွက်လိုက်မထွက်လိုက် မလို့ပါ

  12. Min Thu Han says:

    Hi Ko Kyaw Zwar

    Squid ထဲမှာ Internet Line တွေဘယ်လိုပေါင်း တာတွေရေးပေးပါအုန်း။ ကျေးဇူးတင်ပါတယ်။

  13. Devil says:

    ကိုကျော်စွာ . ကျွန်တော့်ဆီမှာ squid service မ run ဘူးဖြစ်နေတယ် .. ဘာမှားလို့လဲမသိဘူး ..

  14. liquid says:

    အကိုရေ Client ရဲ့ Web browser မှာ noproxy ,auto-detect နဲ့ သုံးချင်ပါတယ် ။ အဲဒီလိုအသုံးပြုမယ်ဆို Squid config
    မှာဘယ်လို ပြင်ဆင်ရပါမည်လဲ ခင်ဗျာ။နောက်တစ်ခုကတော့ တစ်ခါတလေ ကျွန်တော်တို့ မြန်မာမှာ proxy no တွေထွက်လာပြီး ကျော်သုံးကြပါတယ်။အဲဒီလို အခါမျိုးမှာ ICS နဲ့ရိုးရိုး Share ပေးထားမယ်ဆိုရင် Client Browser တွေမှာ လိုသလို proxy no တွေပြောင်းလဲသုံးနိုင်ပါတယ်။ Squid Service နဲ့Share ပေးထားတဲ့ Client Browser တွေမှာပါ လိုသလို ပြောင်းလဲအသုံးပြုလို့ရပါသလားခင်ဗျာ။အဲဒီအတွက်ဘယ်လိုပြင်ဆင်ပေးရပါမလဲခင်ဗျာ။ကျေးဇူးတင်ပါတယ်။

  15. Alvin You says:

    ဖြစ်နိုင်ရင် Kerio winroute ရဲ့ အကြောင်းလေးဆွေးနွေးပေးပါခင်ဗျာ….

  16. Alvin You says:

    kerio winroute control configuration setting ပြုလုပ်ပုံလည်းသိချင်ပါတယ်ရေးပေးကြပါအုံးဗျာ

Leave a comment


*