ITPub博客

首页 > IT基础架构 > 网络安全 > squid 简单配置

squid 简单配置

原创 网络安全 作者:tonykorn97 时间:2008-10-20 14:18:18 0 删除 编辑

配置squid让同网段内的其他机器可以使用

一,安装:
[root@station10 ~]# yum -y install squid

[@more@]


二,启动默认配置:
[root@station10 ~]# chkconfig squid on
[root@station10 ~]# service squid start
Starting squid: .[ OK ]
[root@station10 ~]#


三,默认的配置信息:
http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin ?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
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
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
http_reply_access allow all
icp_access allow all
coredump_dir /var/spool/squid


四,查看访问的信息:
[root@station10 ~]# tail -f /var/log/squid/access.log
1224506740.327 354 127.0.0.1 TCP_REFRESH_HIT/304 307 GET http://192.168.0.10/ - DIRECT/192.168.0.10 -
1224506746.019 44 192.168.0.12 TCP_DENIED/403 1452 GET http://www10.example.com/ - NONE/- text/html

本机可以访问,其他机器不能访问

五,设置iptables
[root@station10 ~]# iptables -I INPUT -s 192.168.0.0/24 -p tcp --dport 3128 -j ACCEPT
[root@station10 ~]# service iptables save
Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
[root@station10 ~]# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 192.168.0.0/24 anywhere tcp dpt:squid

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
[root@station10 ~]#

六, 编辑squid文件,让同子网内可以使用

1,在acl CONNECT method CONNECT下面新增:
acl example src 192.168.0.0/24

2,在# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS行下面新增:
http_access allow example

3,重新导入配置:
[root@station10 squid]# service squid reload
[root@station10 squid]#


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/312079/viewspace-1012148/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: sendmail配置
请登录后发表评论 登录
全部评论

注册时间:2007-12-05

  • 博文量
    1854
  • 访问量
    2088301