以下是Centos7代理模式访问外网
1、首先这个是代理服务器地址,通过这个代理地址可以访问外网
http://40.125.172.218:7878
这台代理服务器要运行centos7来访问
2、为centos7配置这个代理地址,就可以让centos7访问外网了
1、 这样永久生效(会让流量全部走代理)
vim /etc/profile
http_proxy=http://[代理地址]:[代理地址的端口]/
https_proxy=http://[代理地址]:[代理地址的端口]/
export http_proxy https_proxy
source /etc/profile
# 临时生效,这样马上生效
export http_proxy=http://40.125.172.218:7878
export https_proxy=https://40.125.172.218:7878
# 取消
unset http_proxy 或 exit
2、测试
# curl -I http://www.google.com
HTTP/1.1 200 OK
可以看到,获取到的IP已经变成了代理服务器的外网IP
3、如果想和修改前对比,可以
unset http_proxy
curl http://toyaml.com:9999/whoami