共享网络
加快访问速度,节约通信带宽
防止内部主机受到攻击
限制用户访问,完善网络管理
代理服务器原理
代理服务器接受到请求后,首先与访问控制列表中的访问规则相对照,如果满足规则,则在缓存中查找是否存在需要的信息。
客户端B向代理服务器提出相同的请求。代理服务器也首先与访问控制列表中的访问规则相对照。如果满足规则,则将缓存中的信息传送给客户端B
squid简介
访问控制清单和访问权限清单通过阻止特定的网络连接来减少潜在的Internet非法连接,可以使用这些清单来确保内部网的主机无法访问有威胁的或不适宜的站点。
以下是一些squid的基本配置参数解释
http_port 3128 //设置监听的IP与端口号
cache_mem 64 MB //设置内存缓冲的大小
cache_dir ufs /var/spool/squid 2000 16 256 //设置硬盘缓冲大小
cache_effective_user squid //设置缓存的有效用户
cache_effective_group squid //设置缓存的有效用户组
dns_nameservers 192.168.0.254 //设置DNS服务器地址,一般可以不设置,默认使用服务器自己设置的dns
cache_access_log /var/log/squid/access.log //设置访问日志文件
cache_log /var/log/squid/cache.log //设置缓存日志文件
visible_hostname 192.168.0.20 //设置squid主机名称
以上全局参数根据你自己的需要修改
其实linux下的服务器配置文件最好就是squid,它对每个参数都有解释,而且很多有很多实例
Acl的访问控制列表
语法:acl 列表名称 列表类型 [-i] 列表值
列表名称:用于区分Squid的各个访问控制列表,任何两个访问控制列表不能用相同的列表名。虽然列表名称可以随便定义,但为了避免以后不知道这条列表是干什么用的,应尽量使用有意义的名称,如badurl、clientip和work time等。
列表类型:是可被Squid识别的类别。Squid支持的控制类别很多,可以通过IP地址、主机名、MAC地址和用户/密码认证等识别用户,也可以通过域名、域后缀、文件类型、IP地址、端口和URL匹配等控制用户的访问,还可以使用时间区间对用户进行管理
-i选项:表示忽略列表值的大小写,否则Squid是区分大小写的。
列表值:针对不同的类型,列表值的内容是不同的。例如,对于类型为src或dst,列表值的内容是某台主机的IP地址或子网地址;对于类型为time,列表值的内容是时间;对于类型为srcdomain和dstdomain,列表值的内容是DNS域名。
列表类型和列表值,在配置文件中有很多例子
现在我们去看看
现在我们开始配置squid
默认有一条http_access deny all ,在2500多行,squid配置文件的acl生效顺序是从上到下,所以需要在这条前面写入允许语句
这个要注意,是squid服务器监听的端口
大家搜索ACCESS CONTROLS
我们一般把允许语句写到这个位置
加入两行,第一行是acl内容,定义源是192.168.8.0 网段
第二行是允许全部的语句
然后重新启动squid
OK了~
在windows下使用代理服务器,开IE,工具,inter选项,连接,局域网设置
现在你client就访问你服务器能访问的所有网站了
##############MICHAEL分割线##################
下面可以自己加一些策略,让squid按照我们的思路去工作
1、不允许192.168.8.24这个用户使用squid
记住deny要在允许所有之前,不然就会失效
修改配置文件,一定要记住重新启动
直接就访问拒绝了
这里有实例的
192.168.1.10-192.168.1.20/255.255.255.0的意思就是定义源为一个范围
src是源IP的意思
dst就是目标IP的意思
dstdomain是目标域名的意思
现在我们要192.168.8.24这个用户可以访问其他网站,但是不能访问163.com
其他用户的访问不受限制,大家有方法实现么?
这样就可以了
意思是同时匹配list2和list3就deny掉
注意:
acl list2 src 192.168.8.24 后面不能加上/255.255.255.0,否则会导致其他IP也不能访问163.com
acl list3 dstdomain .163.com,不能忘记加上".",正是它指出以此域名结尾的所有主机都不可访问,否则会导致不能访问163.com,而可以访问[url]www.163.com[/url]等哈~
[url]www.yahoo.com[/url]访问正常
[url]www.163.com[/url] 及news.163.com等163.com域名的网站禁止访问
[url]www.qq.com[/url]访问正常
看下其他客户端192.168.8.25
正常~~~
##############MICHAEL分割线##################
可以禁止用户通过网页下载某些特殊的扩展名字文件,如mp3,mp4
现在我们去添加策略
重新启动squid
现在就不能下载了
##############MICHAEL分割线##################
最后一个常用功能:基于时间的控制
192.168.8.200每天13:00-17:00禁止上网
重启服务后看下效果
哈~现在一个都不能访问了
还可以加星期几,里面很多实例,大家自己看看吧
客户端192.168.8.200周六周日下午13:00-17:00允许上网
OK~
加快访问速度,节约通信带宽
防止内部主机受到攻击
限制用户访问,完善网络管理



















acl list3 dstdomain .163.com,不能忘记加上".",正是它指出以此域名结尾的所有主机都不可访问,否则会导致不能访问163.com,而可以访问[url]www.163.com[/url]等哈~






















标签:
Squid,服务器配置
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
内蒙古资源网 Copyright www.nmgbbs.com
暂无“Linux服务器架设笔记 Squid服务器配置”评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。