由於最近公司一直在查軟件的版權,另外使用的CCProxy代理服務器也是一直在跳轉廣告。於是在XenServer中安裝了CentOS6.4,CentOS的網卡設置為:

CentOS 6.4 Squid代理服務器設置_第1张图片

從上圖可以看到

WAN網卡是eth1,LAN網卡是eth0



我們使用yum來安裝Squid:

[root@PROXY ~]# yum -y install squid

備份squid的配置文件,防止因為配置錯誤

[root@PROXY ~]# cp /etc/squid/squid.conf /etc/squid/squid.conf_bak

配置squid.conf

找到

http_port 3128修改成http_port 192.168.100.10:3128

并添加

visible_hostname squid

acl innet src 192.168.100.0/24

http_access allow innet   #這行是允許192.168.100.0網段的用戶代理

http_access deny all   #這行是拒絕所有的代理



下面就運行squid -z進行初始化

[root@PROXY ~]# squid -z

2013/05/29 13:41:43| Creating Swap Directories

啟動squid代理服務器

[root@PROXY ~]# service squid start

并將squid設置成開機啟動

[root@PROXY ~]# chkconfig --level 35 squid on