-
مشکل در Squid
با سلام خدمت اساتید گرامی
من تنظیمات Squid را طبق پست های این انجمن انجام دادم [IMG]http://www.forum.persianadmins.ir/images/smilies/emotions.gif[/IMG] وقتی پروکسی رو Browser ست می شه مشکلی نیستو همه چی کار میکنه ولی موقعی ست نمیشه با اینکه تنظیمات Transparent و انجام دادم اما از کش نمی خونه!! [IMG]http://www.forum.persianadmins.ir/images/smilies/smiley-undecided.gif[/IMG]
مشخصات
[CODE]
OS: Centos 5.7
Squid: 2.6.STABLE21
[/CODE]
تنظیمات فایل squid.conf
[CODE]
acl all src 0.0.0.0/0.0.0.0acl 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 to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl CONNECT method CONNECT
acl mynet src 192.168.91.0/24
http_access allow mynet
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow all
http_port 192.168.91.132:3128 transparent
hierarchy_stoplist cgi-bin ?
cache_mem 8 MB
cache_dir ufs /var/spool/squid 100 16 256
access_log /var/log/squid/access.log squid
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/spool/squid
[/CODE]
و کدها برای Redirect کردن پورت
[CODE]
#!/bin/sh
# ------------------------------------------------------------------------------------
# See URL: http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html
# (c) 2006, nixCraft under GNU/GPL v2.0+
# -------------------------------------------------------------------------------------
# squid server IP
SQUID_SERVER="192.168.91.132"
# Interface connected to Internet
INTERNET="eth0"
# Interface connected to LAN
LAN_IN="eth1"
# Squid port
SQUID_PORT="3128"
# DO NOT MODIFY BELOW
# Clean old firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Load IPTABLES modules for NAT and IP conntrack support
modprobe ip_conntrack
modprobe ip_conntrack_ftp
# For win xp ftp client
#modprobe ip_nat_ftp
echo 1 > /proc/sys/net/ipv4/ip_forward
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
# Unlimited access to loop back
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j ACCEPT
# set this system as a router for Rest of LAN
iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE
iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT
# unlimited access to LAN
iptables -A INPUT -i $LAN_IN -j ACCEPT
iptables -A OUTPUT -o $LAN_IN -j ACCEPT
# DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy
iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to $SQUID_SERVER:$SQUID_PORT
# if it is same system
iptables -t nat -A PREROUTING -i $INTERNET -p tcp --dport 80 -j REDIRECT --to-port $SQUID_PORT
# DROP everything and Log it
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP
[/CODE]
طفا راهنمایی کنین، کارم خیلی لنگه[IMG]http://www.forum.persianadmins.ir/images/smilies/smiley-cry.gif[/IMG]
-
از کجا فهمیدید از کش نمیخونه ؟
-
[QUOTE=f14f21;344402]از کجا فهمیدید از کش نمیخونه ؟[/QUOTE]
با سپاس از توجه تون:D
با استفاده از دستور لاگ دسترسی
tail -f /var/log/squid/access.log
-
میشه لطفا تنظیمات فایل squid.conf رو کامل بزاری توی پیج
-
[QUOTE=mamod;344410]میشه لطفا تنظیمات فایل squid.conf رو کامل بزاری توی پیج[/QUOTE]
بالا گذاشتم اونايي كه فعالن(با # غير فعال نشدن)
اينم يه كپي ديگه
[CODE]
acl all src 0.0.0.0/0.0.0.0acl 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 to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl CONNECT method CONNECT
acl mynet src 192.168.91.0/24
http_access allow mynet
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow all
http_port 192.168.91.132:3128 transparent
hierarchy_stoplist cgi-bin ?
cache_mem 8 MB
cache_dir ufs /var/spool/squid 100 16 256
access_log /var/log/squid/access.log squid
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/spool/squid
[/CODE]
-
و کدها برای Redirect کردن پورت
[QUOTE]
#!/bin/sh # ------------------------------------------------------------------------------------ # See URL: [url=http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html]Linux: Setup a transparent proxy with Squid in three easy steps[/url] # (c) 2006, nixCraft under GNU/GPL v2.0+ # ------------------------------------------------------------------------------------- # squid server IP SQUID_SERVER="192.168.91.132" # Interface connected to Internet INTERNET="eth0" # Interface connected to LAN LAN_IN="eth1" # Squid port SQUID_PORT="3128" # DO NOT MODIFY BELOW # Clean old firewall iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X # Load IPTABLES modules for NAT and IP conntrack support modprobe ip_conntrack modprobe ip_conntrack_ftp # For win xp ftp client #modprobe ip_nat_ftp echo 1 > /proc/sys/net/ipv4/ip_forward # Setting default filter policy iptables -P INPUT DROP iptables -P OUTPUT ACCEPT # Unlimited access to loop back iptables -A INPUT -i lo -j ACCEPT iptables -A OUTPUT -o lo -j ACCEPT # Allow UDP, DNS and Passive FTP iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j ACCEPT # set this system as a router for Rest of LAN iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT # unlimited access to LAN iptables -A INPUT -i $LAN_IN -j ACCEPT iptables -A OUTPUT -o $LAN_IN -j ACCEPT # DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to $SQUID_SERVER:$SQUID_PORT # if it is same system iptables -t nat -A PREROUTING -i $INTERNET -p tcp --dport 80 -j REDIRECT --to-port $SQUID_PORT # DROP everything and Log it iptables -A INPUT -j LOG iptables -A INPUT -j DROP
میشه بیشتر توضیح بدین این تنظیمات تو چه فایلی قرار دادین
[/QUOTE]
-
[QUOTE=mehdi_zx;344437]و کدها برای Redirect کردن پورت[/QUOTE]
ممنون دوست عزیز :D
ولی من این سایتم دیدم و عیانا طبق تنظیمات اون جلو رفتم ولی بازم نشد که نشد :confused:
اینا رو هم گذاشتم ارور Parse گرفت[LEFT][CODE]
httpd_accel_host [COLOR=#FF0000]virtual[/COLOR]
httpd_accel_port [COLOR=#FF0000]80[/COLOR]
httpd_accel_with_proxy [COLOR=#FF0000]on[/COLOR]
httpd_accel_uses_host_header [COLOR=#FF0000]on[/COLOR]
[/CODE]
[/LEFT]
فکر کنم برا اینکه ورژن Squid، 2.6 باشه!
اگه نه لطفا کمک کنید
کسی از دوستان که تونسته Redirect و کامل انجام بده و نتیجه بگیره لطف کنه توزیع لینوکس و ورژن Squid و بگه،
شاید از اینا باشه!؟
-
[CODE]
http_proxy 3128 transparent
[/CODE]
-
دوست عزیز من تو سکوید تازه کارم منظورم این بود که این تنظیمات باشد رو فایل خاصی انجام داد یا توی روت باید تایپش کرد
[QUOTE]#!/bin/sh # ------------------------------------------------------------------------------------ # See URL: [URL="http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html"]Linux: Setup a transparent proxy with Squid in three easy steps[/URL] # (c) 2006, nixCraft under GNU/GPL v2.0+ # ------------------------------------------------------------------------------------- # squid server IP SQUID_SERVER="192.168.91.132" # Interface connected to Internet INTERNET="eth0" # Interface connected to LAN LAN_IN="eth1" # Squid port SQUID_PORT="3128" # DO NOT MODIFY BELOW # Clean old firewall iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -t mangle -F iptables -t mangle -X # Load IPTABLES modules for NAT and IP conntrack support modprobe ip_conntrack modprobe ip_conntrack_ftp # For win xp ftp client #modprobe ip_nat_ftp echo 1 > /proc/sys/net/ipv4/ip_forward # Setting default filter policy iptables -P INPUT DROP iptables -P OUTPUT ACCEPT # Unlimited access to loop back iptables -A INPUT -i lo -j ACCEPT iptables -A OUTPUT -o lo -j ACCEPT # Allow UDP, DNS and Passive FTP iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j ACCEPT # set this system as a router for Rest of LAN iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT # unlimited access to LAN iptables -A INPUT -i $LAN_IN -j ACCEPT iptables -A OUTPUT -o $LAN_IN -j ACCEPT # DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to $SQUID_SERVER:$SQUID_PORT # if it is same system iptables -t nat -A PREROUTING -i $INTERNET -p tcp --dport 80 -j REDIRECT --to-port $SQUID_PORT # DROP everything and Log it iptables -A INPUT -j LOG iptables -A INPUT -j DROP
میشه بیشتر توضیح بدین این تنظیمات تو چه فایلی قرار دادین[/QUOTE]
-
[QUOTE=darklove;344545][CODE]
http_proxy 3128 transparent
[/CODE][/QUOTE]
پیمان جان ممنون از توجه تون
من بدون IP سرور هم زدم نشد!;)
[QUOTE=mehdi_zx;344550]دوست عزیز من تو سکوید تازه کارم منظورم این بود که این تنظیمات باشد رو فایل خاصی انجام داد یا توی روت باید تایپش کرد[/QUOTE]
اگه به این [URL="http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html"]لینک[/URL] مراجعه کنی کامل نوشته!
ولی اینارو تو یه فایل متنی به نام [URL="http://www.cyberciti.biz/tips/wp-content/uploads/2006/06/fw.proxy.txt"]fw.proxy[/URL] باید Save کنی! و در مسیر[LEFT][CODE]/etc[/CODE][/LEFT]
قرار بدی بعد این دستورات و اجرا کنی
[LEFT][CODE]
# chmod +x /etc/fw.proxy
# /etc/fw.proxy
# service iptables save
# chkconfig iptables on
# /etc/init.d/squid restart
# chkconfig squid on
[/CODE]
[/LEFT]
:blush:
-
Squid.conf اینجا قرار بدهید با خطاهایی که میدهد ؟
-
ببخشید وسط سوال یک دوست دیگه امدم چون من هم مشکل دارم با نصب سکوید تو این تاپیک مشکلم می گم من سکوید با نصب کردم حالا می خواهیم کانفیکش کنیم ماندیم که این کدهای که بچه م یگن کجا افیل کانفیک بایداضافه کم کنم فایل پیش فرض سکویدم هست
[url=http://s1.picofile.com/file/7302159458/squid.conf.html]squid[/url]
-
من که تنظیمات خاصی ندیدم، همه پیش فرض بودند.
-
خوب کجاهاش باید تغییر بدم تا سکوید تنظیم بشه میشه بیشتر توضیح بدین
-
[QUOTE=darklove;344614]Squid.conf اینجا قرار بدهید با خطاهایی که میدهد ؟[/QUOTE]
سپاس پیمان جان!
و 2بار بالا فایل squid.conf گذاشتم ولی خوب بازم قرار می دم، ;)
با استفاده از Shell Command زیر
[CODE][LEFT]cat /etc/squid/squid.conf | sed '/ *#/d; /^ *$/d'
[/LEFT]
[/CODE]
اونایی فعال هستند رو اینجا قرار میدم.
[CODE][LEFT]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 to_localhost dst 127.0.0.0/8
acl SSL_ports port 443
acl CONNECT method CONNECT
acl mynet src 192.168.91.0/24
http_access allow mynet
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow all
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
cache_mem 8 MB
cache_dir ufs /var/spool/squid 100 16 256
access_log /var/log/squid/access.log squid
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/spool/squid
[/LEFT]
[/CODE]
ولی Error نداره، یعنی همه چیز درسته! فقط مشکل در Redirect کردن درخواستهای پورت 80 به پورت 3128 است که بصورت اتوماتیک انجام نمی پذیرد و حتما برای استفاده باید پروکسی در Browser ست شود!! :blush: