實驗環境:
>(1)雙網卡Redhat7系統--SQUID
(2)Redhat7系統--WEB
(3)Windows 7 --物理機
實驗環境部署:
SQUID :外網使用NAT模式
內網IP 172.25.0.10/24 網關 0.0.0.0
WEB : 內網IP 172.25.0.11/24 網關 172.25.0.10
物理機:能夠ping通SQUID的外網卡
實驗過程:
WEB 部署apache服務
[root@localhost ~]# yum - y install httpd
設置apache網頁的主頁面
[root@localhost ~]# echo “this is a squid server ” > /var/www/html/index.html
重啓apache服務
[root@localhost ~]# systemctl restart httpd
關閉防火牆
[root@localhost ~]# systemctl stop firewalld
SQUID
安轉squid服務
[root@localhost ~]# yum -y install squid
配置squid主配置文件
添加:
http_access allow all
cache_peer 172.25.0.11 parent 80 0 originserver weight=1
#172.25.0.11 爲apache服務器的ip地址
修改:http_port 3128 爲http_port 80 accel vhost
重啓下squid服務
[root@localhost ~]# systemctl restart squid
關閉防火牆
[root@localhost ~]# systemctl stop firewalld
物理機
打開瀏覽器輸入squid外網卡的ip地址,查看是否跳轉到web服務器的頁面