Centos7内网服务器配置tinyproxy上外网
需求
现在有服务器134,135,137,138 四台服务器,134能上外网,其他的不能上外网,需要解决其他不能上外网的问题
前提
1)2个centos7服务器,其中192.168.129.221能上网,192.168.129.222不能上网
2)互相能ping通
实现
在221上安装tinyproxy软件
安装tinyproxy
1 | yum install -y tinyproxy |
修改tinyproxy配置文件
1 2 3 4 | cat >> /etc/tinyproxy/tinyproxy.conf <<"EOF" Port 8888 Allow 0.0.0.0/0 EOF |
启动服务:
1 2 3 | systemctl restart tinyproxy systemctl status tinyproxy netstat -tulnp | grep 8888 |
客户端配置:
1 2 3 4 5 | alias proxy='export http_proxy=http://192.168.6.22:3128;export https_proxy=http://192.168.6.22:3128' alias unproxy='unset http_proxy https_proxy' proxy |
测试:
1 2 | curl -x 192.168.129.221:8888 www.baidu.com yum reinstall -y unixODBC |
注意
因为只代理了HTTP协议,如果使用SOCKS5代理也只能代理UDP及以上的协议。而PING使用的是ICMP协议,不属于上述范围,自然是ping不通的www.baidu.com了。