请问:如何用squid+ipchains做外部http代理?

由 vagrom 在 07-17-2003 20:36 发表:

请问:如何用squid+ipchains做外部http代理?

我现在想用squid+ipchains做一个http代理,但我做这个不是为局域网提供上网,而是为学校外面的IP访问图书馆资源作代理。

因是初手,所以试了两天都没成功,希望在这方面有经验的朋友能帮我一下。我先谢各位了。

因为试了n次也没成功,所以我现在的ipchains和squid都是最简单的配置:

内部IP:192.168.2.*

外部IP:202.111.111.*

DNS:202.111.0.*

ipchanis.rules

echo "1" > /proc/sys/net/ipv4/ip_forward

/sbin/ipchains -F input

/sbin/ipchains -F output

/sbin/ipchains -F forward

/sbin/ipchains -A input -i lo -j ACCEPT

/sbin/ipchains -A input -p tcp -s 0.0.0.0/0 -d ! 202.111.111.* 80 -j REDIRECT 3128

/sbin/ipchains -A forward -s 192.168.2.0/24 -d 0.0.0.0/0 -j MASQ

说明:因为这台机器要提供web服务,所以用 -d ! 202.111.111.*

squid.conf

http_port 80

cache_mem 32 MB

cache_swap_low 90

cache_swap_high 95

maximum_object_size 4096 KB

cache_dir /var/spool/squid 4096 16 256

cache_access_log /var/log/squid/access.log

cache_log /var/log/squid/cache.log

cache_store_log /var/log/squid/store.log

dns_nameservers 202.111.0.*

unlinkd_program /usr/lib/squid/unlinkd

acl all src 0.0.0.0/0.0.0.0

acl manager proto cache_object

acl localhost src 202.111.111.*/255.255.255.255

acl SSL_ports port 443 563

acl Safe_ports port 80 21 443 563 70 210 1025-65535

acl CONNECT method CONNECT

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 allow all

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus