squid通过正向代理访问互联网
- 实验环境
客户端:10.1.21.33
squid代理:10.1.21.51
访问网站:百度,腾讯
- squid配置
http_port 3128
acl ITL src 10.1.21.0/24
acl yum req_header User-Agent yum ansible
http_access allow yum ITL
acl clientdomain dstdomain .baidu.com .cnblogs.com
http_access allow clientdomain ITL
acl CONNECT method CONNECT
http_access allow clientdomain ITL CONNECT
#######
no_cache deny all
http_access deny all
logformat combined %{X-Forwarded-For}>h %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log combined
- 访问测试
- 浏览器设置代理测试
2.测试结果,通过代理访问可以访问通过squid放开的百度站点,而腾讯却无法访问,测试完成