预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10
在线预览结束,喜欢就下载吧,查找使用更方便
如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
构建Squid代理服务器
配置Squid实现基本代理功能
Internet
Squid代理服务器
局域网PC机
192.168.10.2/24
eth1:192.168.10.1/24
eth1:200.100.100.1/24
Web.benet.com218.29.30.29/30
配置Squid实现基本的代理功能
1、查看IP
eth0Linkencap:EthernetHWaddr00:0C:29:4A:88:90
inetaddr:192.168.10.1Bcast:192.168.10.255Mask:255.255.255.0
eth1Linkencap:EthernetHWaddr00:0C:29:4A:88:9A
inetaddr:200.100.100.1Bcast:200.100.100.255Mask:255.255.255.0
2、查看主机名
[root@s2~]#hostname
s2.benet.com
开启路由转发
[root@s2squid]#vi/etc/sysctl.conf
net.ipv4.ip_forward=1
3、搭建DNS并验证
[root@s2~]#nslookup
>wwww.^H^H^H[root@s2~]#
[root@s2~]#nslookup
>www.benet.com
Server:192.168.10.1
Address:192.168.10.1#53
Name:www.benet.com
Address:192.168.10.2
>web.benet.com
Server:192.168.10.1
Address:192.168.10.1#53
Name:web.benet.com
Address:200.100.100.2
>
4、启动防火墙
[root@s2~]#serviceiptablesstart
Flushingfirewallrules:[OK]
SettingchainstopolicyACCEPT:manglerawnatfilter[OK]
Unloadingiptablesmodules:[OK]
Applyingiptablesfirewallrules:[OK]
Loadingadditionaliptablesmodules:ip_conntrack_netbios_ns[OK]
5、清空各个表中的所有规则链
[root@s2~]#iptables-F
[root@s2~]#iptables-tnat-F
[root@s2~]#iptables-traw-F
[root@s2~]#iptables-tmangle-F
7、拷贝Squid主配置文件并过滤
[root@s2squid]#pwd
/etc/squid
[root@s2squid]#ls
cachemgr.confmib.txtmsntauth.confsquid.conf.default
errorsmime.confmsntauth.conf.default
iconsmime.conf.defaultsquid.conf
[root@s2squid]#cp-psquid.confsquid.conf.bak
[root@s2squid]#grep-v"^#"squid.conf.bak|grep-v"^$">squid.conf
8、配置Squid代理服务器端
http_port3128//端口号
visible_hostnames2.benet.com//指定可见的主机名
http_accessallowall//查找并修改此行,默认是拒绝
9、初始化并启动服务
[root@s2squid]#servicesquidrestart
Stoppingsquid:[FAILED]
init_cache_dir/var/spool/squid...Startingsquid:.[OK]
10修改客户端的浏览器设置,指定所使用代理服务器的IP地址、端口号。
12、客户端测试验证
配置透明代理
Internet
Squid代理服务器
局域网PC机
192.168.10.2/24
eth1:192.168.10.1/24
eth1:200.100.100.1/24
Web.bent.com218.29.30.29/30
配置透明代理
1、查看IP
eth0Linkencap:EthernetHWaddr00:0C:29:4A:88:90
inetaddr:192.168.10.1Bcast:192.168.10.255Mask:255.255.255.0
eth1Linkencap:EthernetHWaddr00:0C:29:4A:88:9A
in