曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 5356|回复: 0
打印 上一主题 下一主题

[系统应用] OpenWRT Squid transparent configuration

[复制链接]

4917

主题

5879

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34382
跳转到指定楼层
楼主
发表于 2015-8-2 16:49:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[Bash shell] 纯文本查看 复制代码
Squid required:
Mount HD (15GB min) on /tmp/cache, chmod -R 777 /tmp/cache

Firewall section:
config redirect
        option src 'lan'
        option proto 'tcp'
        option src_ip '!192.168.1.1'
        option src_dport '80'
        option dest_ip '192.168.1.1'
        option dest_port '3128'
        option target 'DNAT'

/etc/init.d/firewall reload/restart

Squid confiuration:
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 0.0.0.0/32
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/24	# RFC1918 possible internal network
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
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 deny all
icp_access allow localnet
icp_access deny all
http_port 3128 transparent
visible_hostname SquidBox
hierarchy_stoplist cgi-bin ?
cache_mem 8 MB
maximum_object_size_in_memory 8 KB
cache_dir ufs /tmp/cache 15000 16 512
maximum_object_size 32 MB
access_log /tmp/cache/access.log squid
#access_log none
cache_log /tmp/cache/cache.log
cache_store_log /tmp/cache/store.log
pid_filename /tmp/cache/squid.pid
netdb_filename /tmp/cache/netdb.state
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
#acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
#upgrade_http0.9 deny shoutcast
#acl apache rep_header Server ^Apache
#broken_vary_encoding allow apache
#dns_nameservers 127.0.0.1
coredump_dir /tmp/cache

Usage:
squid -z (create cache directory)
squid -D 
squid -k kill/configure
      use -f cfgfile if is moved


Remember to launch Squid with rc file.

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-5-1 22:00 , Processed in 0.063679 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表