smith88 发表于 2018-12-27 10:38:59

RHEL 6 简易搭建squid服务 RHCE

  本文介绍了Squid代理服务器的简易搭建,从rhel6来看,其配置文件较rhel5要少了很多,这点应着重学习
  #rpm –qa | grep squid* [查看squid包是否已经安装],下图为没有安装的情况
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_130936524266CP.png
  #yum install squid*//通过yum方式安装
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365243DWAL.png
  该服务只需要安装一个包
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365245kKWr.png
  #chkconfig squid –list [查看服务启动状态]
  #chkconfig squid on[开启2、3、4、5模式下的自动启动]
  #chkconfig squid –list[再次群人服务启动状态]
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365247tdT4.png
  #vim /etc/sysctl.conf [开启IP转发]
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365247PiVe.png
  将“0”修改成“1”,1表示开启、0表示不启用
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365249W6SJ.png
  #sysctl –p /etc/sysctl.conf [使IP转发永久生效]
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365251ljsm.png
  #vim /etc/squid/squid.conf [修改squid的配置文件]
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365252JXuk.png
  添加图中list1、list2四行内容
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365254K0X0.png
  将3128修改成8080,代理服务器端口,习惯使用8080
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365257i62F.png
  #service squid restart [启动squid服务]
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365258wRFM.png
  使用另外一个主机进行测试,将浏览器调整为使用代理服务器,并且填入代理服务器地址
  将ip地址设置为192.168.1.3、则无法访问baidu
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365261kQtX.png
  若将ip地址设置为192.168.1.5 (192.168.1.0网段其他地址也可),则可以正常访问
http://sandyice.blog.运维网.com/attachment/201106/29/2589227_1309365263Fxcb.png
  后记:代理服务器是一门学问,日后大家可以慢慢研究



页: [1]
查看完整版本: RHEL 6 简易搭建squid服务 RHCE