netstat -an 觀察瀏覽器連接目標 IP:Port,高頻出現即為代理。export http_proxy=https://proxy_ip:port/export https_proxy=https://proxy_ip:port/export ftp_proxy=ftp://proxy_ip:port/export no_proxy="localhost,127.0.0.1,::1,.internal.corp" # 繞過代理# 帶認證export http_proxy=https://user:pass@proxy_ip:port/ # 特殊字符需 URL 編碼 持久化:寫入 ~/.bashrc / /etc/profile.d/proxy.sh。
| 工具 | 配置方式 |
|---|---|
| wget | wget --proxy-user=USER --proxy-password=PASS URL 或 wget --no-proxy URL 繞過 |
| curl | curl -x https://proxy_ip:port URL (HTTP/HTTPS)curl --socks4 proxy_ip:port URLcurl --socks5 proxy_ip:port URLcurl -U user:pass URL (使用環境變量代理)curl --noproxy URL 繞過 |
| apt | echo 'Acquire::http::Proxy "https://proxy_ip:port/";' > /etc/apt/apt.conf.d/99proxy |
| yum/dnf | proxy=https://proxy_ip:port/ 寫入 /etc/yum.conf [main] 區段 |
| git | git config --global http.proxy https://proxy_ip:portgit config --global https.proxy https://proxy_ip:portgit config --global --unset http.proxy 取消 |
| npm | npm config set proxy https://proxy_ip:portnpm config set https-proxy https://proxy_ip:port |
| pip | pip install --proxy https://proxy_ip:port package |
| Docker (daemon) | /etc/systemd/system/docker.service.d/http-proxy.conf:[Service]Environment="HTTP_PROXY=https://proxy_ip:port/"Environment="HTTPS_PROXY=https://proxy_ip:port/"Environment="NO_PROXY=localhost,127.0.0.1,.internal.corp"然後 systemctl daemon-reload && systemctl restart docker |
| Docker (build) | docker build --build-arg HTTP_PROXY=... --build-arg HTTPS_PROXY=... . |
| SSH 穿透代理 | ProxyCommand nc -X connect -x proxy_ip:port %h %p (需 netcat-openbsd) |
Firefox/Chrome:設置 → 網絡 → 代理 → 手動配置 HTTP/HTTPS/SOCKS。GNOME/KDE 系統設置 → 網絡 → 網絡代理 → 同步到環境變量。
curl -I https://www.google.com # 通過代理返回環境變量 IPenv | grep -i proxy # 檢查變量生效