squid 简单配置

配置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博客 ” ,链接:http://blog.itpub.net/312079/viewspace-1012148/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/312079/viewspace-1012148/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值