直接在路由更新列表后查squid安装即可。
初始化磁盘缓存文件夹,配置文件里指定下缓冲存取用户和组:
cache_effective_group nobody
初始化之后可以正常启动了,定义下服务器的地址和端口,transparent表示支持透明代理:http_port 192.168.2.1:8080 transparent
设置下缓冲所使用的内存和磁盘缓存目录:
cache_mem 8 MB
cache_dir ufs /opt/var/squid/cache 40 16 256
定义防火墙规则:
http_access allow all
然后设置iptables防火墙规则:
iptables -t nat -A PREROUTING -i br0 -p tcp -s 192.168.2.0/24 --dport 80 -j REDIRECT --to-ports 8080
用ifconfig看下,由于之前在conf文件里定义了代理服务器的端口和地址,192.168.2.1:8080,,所以要把目标端口为80的访问重定向到192.168.2.1:8080,看了下192.168.2.1的网络接口是br0,所以itables规则应该写成上面的形式。
/etc/init.d/squid reload一下,发现已经生效了。

配置文件
error_directory /share/squid/errors/Simplify_Chinese
cache_effective_group nobody
visible_hostname a
cache_mgr webmaster
cache_mem 15 MB
#cache_dir /var/squid/cache null
cache_dir ufs /mnt/disk1/cache 40 16 256
http_access allow all
http_port 192.168.2.1:8080 transparent
cache_store_log none
cache_access_log none
#cache_log none
#iptables -t nat -A PREROUTING -i br0 -p tcp -s 192.168.2.0/24 --dport 80 -j REDIRECT --to-ports 8080

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。