使用squid安装代理

先准备两个虚拟机:
192.168.10.159 客户端
192.168.10.160 squid代理
在squid代理端操作

1.安装squid
yum install squid -y
yum install iptables-services

2.编辑squid配置文件
#vim /etc/squid/squid.conf 
添加以下文本

在这里插入图片描述在这里插入图片描述

3.防火墙配置
systemctl stop firewald.service 
systemctl disable firewald.service
yum install iptables-services iptables-devel -y
systemctl enable iptables.service
systemctl start iptables.service
iptables -I INPUT 1 -s 192.168.10.0/24 -p tcp --dport 3128 -j ACCEPT
iptables -I INPUT  2 -p tcp --dport 3128 -j DROP 
4.启动squid服务
systemctl start squid 
systemctl enable squid 

在客户端配置

1、使用systemctl stop firewalld 关闭防火墙
2、使用 yum install iptables-services 安装或更新服务
3、使用systemctl enable iptables 启动iptables
4、systemctl start iptables 打开iptables
service iptables save可以操作了
1.linux客户端配置正向代理
export http_proxy=http://192.168.10.160:3128          
export https_proxy=http://192.168.10.160:3128
echo "export http_proxy=http://192.168.10.160:3128" >>/etc/profile
echo "export https_proxy=http://192.168.10.160:3128" >>/etc/profile
2.测试http
  wget http://www.cmake.org/files/v3.3/cmake-3.3.1.tar.gz

3.代理服务器上查看日志/var/log/squid/access.log
在这里插入图片描述4.测试https
wget https://codeload.github.com/gflags/gflags/tar.gz/v2.1.2
5.在代理服务器上查看日志/var/log/squid/access.log
在这里插入图片描述

客户端结果:
在这里插入图片描述服务端结果:在这里插入图片描述

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值