跳转到内容

Linux配置代理上网

来自FC

配置代理

无需验证

export http_proxy=http://proxy_ip:proxy_port
export https_proxy=http://proxy_ip:proxy_port
export SOCKS_SERVER=socks://proxy_ip:proxy_port

需要验证

export http_proxy=http://username:password@proxy_ip:proxy_port
export https_proxy=http://username:password@proxy_ip:proxy_port
export SOCKS_SERVER="socks://username:password@proxy_ip:proxy_port"

删除代理

unset http_proxy
unset https_proxy
unset SOCKS_SERVER

检查目前使用代理

echo $http_proxy
echo $https_proxy
echo $SOCKS_SERVER

验证代理通断

curl -x <proxy_ip:proxy_port> http://example.com
curl --socks5 <proxy_ip:proxy_port> http://example.com