Skip to content
socks5 代理 http 访问
2025年12月31日 root

建立一台网关服务器

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

Last updated: