1.安裝squid軟件
yum -y install squid
2.配置squid.conf
vim /etc/squid/squid.conf
配置允許訪問的IP地址
acl localnet src 110.184.83.149
image.png
也可以把下面的http_access allow all 改成這樣就是允許所有IP過去
3.在防火墻添加允許策略(這步不知道有沒有用)
iptables -F #清除防火墻filter表中規(guī)則
setenforce 0 #關(guān)閉增強安全×××
iptables -I INPUT -p tcp --dport 3218 -j ACCEPT #這句策略就是允許訪問3218端口的tcp數(shù)據(jù)包通過
service squid reload #重新加載服務(wù)配置
4.初始化squid
squid -z
執(zhí)行這條命令以后會創(chuàng)建文件夾蟆技,但是不會自動退出,直接ctrl+c退出即可。
5.啟動命令與開機自啟
# 啟動
systemctl start squid.service
# 停止
systemctl stop squid.service
# 重啟
systemctl restart squid.service
#設(shè)置開機自啟
systemctl enable squid.service
6.查看3128已經(jīng)在運行服務(wù)了
netstat -ntpl
7.在需要代理的計算機設(shè)置
image.png