建立一台网关服务器
ip地址:xxx.xxx.xxx.xxx 设置 ssh 可以登陆访问
服务端配置
临时使用
bash
ssh -f -N -D 1080 root@xxx.xxx.xxx.xxx
export https_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5h://127.0.0.1:1080永久配置
bash
cat >> ~/.bashrc <<'EOF'
# 让常见命令走本地 SOCKS5(含 DNS 解析)
export ALL_PROXY=socks5h://127.0.0.1:1080
export NO_PROXY=localhost,127.0.0.1,::1
EOF
source ~/.bashrc关闭代理
bash
unset ALL_PROXY测试成功
bash
curl -I https://www.google.com
HTTP/2 200