نوشته اصلی توسط
darklove
Config که بعضی از عیب گرفتم
کد:
http_port 3128 transparent
icp_port 3130
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
cache_mem 64 MB
maximum_object_size 64 MB
minimum_object_size 0 KB
ipcache_size 10240
ipcache_low 90
ipcache_high 95
cache_dir diskd /cache 10240 24 256 Q1=68 Q2=60
cache_log none
cache_store_log none
emulate_httpd_log off
log_fqdn off
pid_filename /var/run/squid.pid
debug_options ALL,1
refresh_pattern ^ftp: 2880 25% 10080
refresh_pattern ^gopher: 2880 0% 2880
refresh_pattern -i \.(htmx|xhtml|sxml|shtml|java|aspx|perl)$ 5760 60% 10080 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(asp|css|php|xml|ocx|html|chtml|phtml)$ 5760 60% 10080 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(jpg|jpe|aac|jpeg|gif|png|bmp|pic)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(mpg|mpeg|mov|avi|midi|wmv|asx|thm)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(mid|wav|mp[234]|rm|ra|ram|wma|au)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(css|js|jar|class|pdf|doc|swf|txt)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(exe|tgz|tbz|tar|gz|bz2|zip|rar|cab)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(xbm|thb|dcr|art|spl|viv|z|vrm|vrml)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(jpg|jpe|aac|jpeg|gif|png|bmp|pic)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(aif|aifc|aiff|arj|c|cpt|dir|dxr|hqx)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(lha|lzh|movie|mpe|mpga|pl|ppt|ps|qt)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern -i \.(qtm|ras|sea|sit|tif|tiff|js|jsp|fla)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
refresh_pattern http://*.windowsupdate.microsoft.com/ 300 60% 20160
refresh_pattern http://windowsupdate.microsoft.com/ 300 60% 20160
refresh_pattern http://download.macromedia.com/ 300 60% 20160
refresh_pattern http://download.microsoft.com/ 300 60% 20160
refresh_pattern http://office.microsoft.com/ 300 60% 20160
refresh_pattern http://wxpsp2.microsoft.com/ 300 60% 20160
refresh_pattern http://ftp.software.ibm.com/ 300 60% 20160
refresh_pattern http://w2ksp4.microsoft.com/ 300 60% 20160
refresh_pattern http://xpsp1.microsoft.com/ 300 60% 20160
refresh_pattern ftp://ftp.nai.com/ 300 60% 20160
refresh_pattern . 300 50% 4320
negative_ttl 5 minutes
positive_dns_ttl 24 hours
negative_dns_ttl 1 minute
range_offset_limit 128 KB
connect_timeout 1 minute
read_timeout 15 minutes
request_timeout 5 minutes
client_lifetime 12 hours
half_closed_clients on
pconn_timeout 120 seconds
shutdown_lifetime 5 seconds
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 Dorsaa src 192.168.0.0/24
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 53 # dns
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 Safe_ports port 901 # SWAT
acl Safe_ports port 161 # SNMP
acl CONNECT method CONNECT
acl purge method PURGE
acl nimda1 urlpath_regex -i \.elm$
acl nimda2 urlpath_regex -i root.exe
acl nimda3 urlpath_regex -i cmd.exe
acl nimda4 urlpath_regex -i ^http://.*www
acl nimda5 urlpath_regex -i readme.exe
acl nimda6 urlpath_regex -i default.id
acl nimda7 urlpath_regex -i :25
acl snmppublic snmp_community XXXX
http_access allow manager localhost
http_access allow purge localhost
http_access allow Dorsaa
http_access allow localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny to_localhost
http_access deny nimda1
http_access deny nimda2
http_access deny nimda3
http_access deny nimda4
http_access deny nimda5
http_access deny nimda6
http_access deny nimda7
http_access deny purge
http_access deny all
icp_access deny all
http_reply_access allow all
snmp_port 3401
snmp_access allow snmppublic localhost
snmp_access deny all
snmp_incoming_address 0.0.0.0
snmp_outgoing_address 255.255.255.255
cache_mgr I@I.com
cache_effective_user squid
cache_effective_group squid
visible_hostname Cache
logfile_rotate 2
memory_pools on
offline_mode off
با سلام و عرض ادب
ممنون دوست عزیز جناب آقای darklove از بابت کانفیگ
دوست عزیزم آقای nanoware از شما هم سپاسگذارم
جسارتا در هر دو کانفیگ یک مشکل وجود دارد :
refresh_pattern -i \.(jpg|jpe|aac|jpeg|gif|png|bmp|pic)$ 20160 95% 99000 ignore-reload override-expire override-lastmod
این refresh_pattern دوبار وارد شده ! که ممکنه باعث ایجاد خطای Duplication بشه ...
در IPTables آقای darklove هیچ چیزی با IPTables آقای kingmkh تغییر نکرده :
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
similar to :
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
at first line just used short names options instead of long name ! such as -A instead of --append , or -t instead of --table and so on ...
and
iptables -t nat -A PREROUTING -s 192.168.0.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
Similar to :
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
at second line just used eth0 device instead of src_addr
در کانفیگ IPTables آقای kingmkh ابتدا کانفیگ را نوپا کردند و بعد سوییچهای مربوطه را اعمال نمودند و تنها آماده سازی صورت گرفته !
در کانفیگ IPTables اول تنها دو ماژول از ماژولهای iptables_ipv4 جهت اضافه نمودن یا حذف کردن آنها به\از هسته با دستور modprobe مورد عنایت قرار گرفته . در صورتی که در کانفیگ آقای darklove یک ماژول irc هم دلپسند واقع شده . اگر احیانا برای زیبایی بیشتر یا محض نیاز به بررسی ماژولهای بیشتری نیاز دارید این چند خط زیر را هم وارد کنید :
modprobe ip_conntrack_amanda
modprobe ip_conntrack_netbios_ns
modprobe ip_conntrack_netlink
modprobe ip_conntrack_pptp
modprobe ip_conntrack_proto_sctp
modprobe ip_conntrack_tftp
در کانفیگ اسکویید آقای kingmkh دستور maximum_object_size 128 MB مقدار زیادی را واگذار نمودید که البته به وسعت شبکه و مقدار فضای درنظر گرفته شده برای cache و تجهیزات و سیاستها و عوامل دیگر بستگی دارد . در کانفیگ آقای darklove تنها ۶۴ KB به عنوان maximum_object_size در نظر گرفته شده !!! توجه کنید که مقادیر متعادل باشند مثلا ۱۵۰۰۰ یا ۳۰۰۰۰ . اگر زیاد باشد مشکلات خاص خود را دارد و اگر خیلی کم باشد تاثیری برای Object هایی با مقدار بالاتر نخواهد داشت ...
در کانفیگ آقای kingmkh , object_in_memory در نظر گرفته شده که برای شبکه مفید خواهد بود و آبجکتهایی با حجم مشخص شده را در حافظه نگه خواهد داشت و از آنجا آبجکتهایی که با درخواست مورد نظر ارتباط دارند صدا زده خواهند شد ... که در Performance شبکه تاثیر خوبی میگذارد ...
فایلهای گزارش گیری ( logfiles ) جهت خطا یابی مفید هستند که بایستی در کانفیگ اعمال شود ...
موارد بسیاری در کانفیگ اول مد نظر قرار گرفته که به همه ی آنها نیازی نیست و بسته به نیاز میتوانید آن را هرس کنید !
ان شاا... دوستان دیگر هم کمک خواهند کرد ...
خوب بودن کانفیگ به زیادی یا کم بودن دستورات موجود در آن بستگی ندارد بلکه به کارکرد بهتر و رفع نیاز مربوطه بستگی دارد .
موفق و موید و پیروز باشید ...