{"id":1594,"date":"2022-02-24T15:05:04","date_gmt":"2022-02-24T15:05:04","guid":{"rendered":"https:\/\/www.ipcpu.com\/?p=1594"},"modified":"2022-06-24T15:06:46","modified_gmt":"2022-06-24T15:06:46","slug":"linux-proxy","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2022\/02\/linux-proxy\/","title":{"rendered":"Linux\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668"},"content":{"rendered":"
<\/div>\n

Linux\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668.md
\n<\/p>\n

\u96f6\u3001\u6982\u8ff0<\/h2>\n

\u6709\u65f6\u5019\uff0c\u6211\u4eec\u5728Linux\u4e0a\u9700\u8981\u8bbf\u95eegithub\u6216\u8005\u662fgoogle\u3001k8s\u4e00\u4e9b\u8d44\u6e90\uff0c\u662f\u9700\u8981\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u7684\u3002\u5982\u679c\u662fwindows\u7684\u8bdd\uff0c\u6709\u5f88\u591a\u7684\u8f6f\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u5168\u5c40\u7684\u4ee3\u7406\uff0c\u4f46\u662fLinux\u4e0b\u6ca1\u6709\u7c7b\u4f3c\u7684\u8f6f\u4ef6\uff0c\u8fd9\u91cc\u603b\u7ed3\u4e86\u4e00\u4e0bLinux\u4e0b\u7684\u4e00\u4e9b\u7528\u6cd5\u3002<\/p>\n

\u4e00\u3001curl \u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668<\/h2>\n

curl\u662fLinux\u6700\u5e38\u7528\u7684\u547d\u4ee4\uff0c\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a
\n\u65b9\u6cd5\u4e00\u3001curl\u547d\u4ee4\u884c\u76f4\u63a5\u6307\u5b9a\u4ee3\u7406<\/strong><\/p>\n

\n
# \u53c2\u6570\u662f-x, --proxy [protocol:\/\/]host[:port]\ncurl -x \"socks5h:\/\/172.28.9.46:10801\" https:\/\/myip.ipip.net\/\n\n#\u5982\u679c\u4e0d\u6307\u5b9a\u534f\u8bae\u7684\u8bdd\u9ed8\u8ba4\u662fHTTP\u534f\u8bae\ncurl -x 172.28.9.46:10802 https:\/\/myip.ipip.net\/<\/code><\/pre>\n<\/div>\n

curl 7.21\u7248\u672c\u5f00\u59cb\u652f\u6301\u4ee3\u7406\u534f\u8bae\u7684\u6307\u5b9a\uff0c7.52\u7248\u672c\u5f00\u59cb\u652f\u6301https\u534f\u8bae\u7684\u4ee3\u7406\u3002
\n\u65b9\u6cd5\u4e8c\u3001\u914d\u7f6e\u6587\u4ef6(~\/.curlrc)\u8bbe\u7f6e\u4ee3\u7406\u670d\u52a1\u5668<\/strong><\/p>\n

\n
# cat ~\/.curlrc\nproxy = \"socks5h:\/\/172.28.9.46:10801\"<\/code><\/pre>\n<\/div>\n

\u4e8c\u3001\u5168\u5c40\u6027\u4ee3\u7406\u914d\u7f6e<\/h2>\n

\u4e0a\u9762\u53ea\u4ecb\u7ecd\u4e86curl\u547d\u4ee4\uff0c\u5f88\u591a\u65f6\u5019\u6211\u4eec\u60f3\u8981\u4e00\u4e2a\u5168\u5c40\u6027\u4ee3\u7406\uff0c\u90a3\u4e48\u9700\u8981\u6309\u7167\u4e0b\u9762\u65b9\u6cd5\uff1a
\n\u6dfb\u52a0\u4ee5\u4e0b\u73af\u5883\u53d8\u91cf<\/p>\n

\n
export http_proxy=http:\/\/172.28.9.46:10802\nexport https_proxy=$http_proxy \nexport ftp_proxy=$http_proxy\nexport rsync_proxy=$http_proxy \nexport all_proxy=$http_proxy\nexport no_proxy=*.abc.com,10.*.*.*,192.168.*.*,*.local,localhost,127.0.0.1<\/code><\/pre>\n<\/div>\n

\u8fd9\u91cc\u9700\u8981\u89e3\u91ca\u4e0b\uff1a<\/p>\n

\n

http_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662fHTTP\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b
\n https_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662fHTTPS\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b
\n ftp_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662fFTP\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b
\n rsync_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662frsync\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b
\n all_proxy\uff1a \u5176\u4ed6\u534f\u8bae\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740
\n no_proxy\uff1a\u4e0d\u4f7f\u7528\u4ee3\u7406\u7684\u4e3b\u673a\u6216IP\u3002<\/p>\n<\/blockquote>\n

\u4f8b\u5982<\/p>\n

\n
#\u4ec5\u8bbe\u7f6e\u8bbf\u95eehttp\u534f\u8bae\u65f6\u4f7f\u7528\u4ee3\u7406\n[root@s101.ipcpu.com ~]#export http_proxy=socks5h:\/\/172.28.9.46:10801\n[root@s101.ipcpu.com ~]#\n[root@s101.ipcpu.com ~]# curl http:\/\/ip.gs\n149.129.129.152\n[root@s101.ipcpu.com ~]# curl https:\/\/ip.gs\n223.102.211.66\n[root@s101.ipcpu.com ~]#\n# \u5173\u95ed\u4ee3\u7406\u8bbe\u7f6e\n[root@s101.ipcpu.com ~]# unset http_proxy\n[root@s101.ipcpu.com ~]# curl http:\/\/ip.gs\n223.102.211.66<\/code><\/pre>\n<\/div>\n

\u4e09\u3001git\u5ba2\u6237\u7aef\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668<\/h2>\n

\u8bbe\u7f6e\u4e86\u5168\u5c40\u4ee3\u7406\uff0c\u53d1\u73b0git\u597d\u50cf\u4e0d\u751f\u6548\uff0c\u56e0\u4e3agit\u4ee3\u7406\u9700\u8981\u5355\u72ec\u8bbe\u7f6e\uff0c\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n

\n
export http_proxy=socks5h:\/\/172.28.9.46:10801\n# \u8bbe\u7f6egit\u4ee3\u7406\n\ngit config --global http.proxy $http_proxy\ngit config --global https.proxy $http_proxy\n# \u5ffd\u7565\u8bc1\u4e66\u9519\u8bef\n#git config --global http.sslverify false\n\n# \u53d6\u6d88git\u4ee3\u7406\ngit config --global --unset http.proxy\ngit config --global --unset https.proxy\n\ngit config --global --unset http.sslverify\n\n<\/code><\/pre>\n<\/div>\n

\u56db\u3001\u5173\u4e8e\u534f\u8bae\u548c\u57df\u540d\u89e3\u6790<\/h2>\n

HTTP\u3001HTTPS\u3001SOCKS5H\u90fd\u662f\u8fdc\u7a0b\u4ee3\u7406\u670d\u52a1\u5668\u6765\u8fdb\u884c\u57df\u540d\u89e3\u6790\u3002
\nSOCKS5\u662f\u672c\u5730\u8fdb\u884c\u57df\u540d\u89e3\u6790\uff0c\/etc\/hosts\u6587\u4ef6\u4f1a\u751f\u6548\u3002
\nSOCKS5H\u534f\u8bae\u6709\u4e9b\u7a0b\u5e8f\u662f\u4e0d\u652f\u6301\u7684\uff0c\u6bd4\u5982wget\u3002<\/p>\n

\u6765\u81ea\u4e3a\u77e5\u7b14\u8bb0(Wiz)<\/a><\/div>\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » Linux\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668<\/a><\/p>","protected":false},"excerpt":{"rendered":"

Linux\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668.md \u96f6\u3001\u6982\u8ff0 \u6709\u65f6\u5019\uff0c\u6211\u4eec\u5728Linux\u4e0a\u9700\u8981\u8bbf\u95eegithub\u6216\u8005\u662fgoogle\u3001k8s\u4e00\u4e9b\u8d44\u6e90\uff0c\u662f\u9700\u8981\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u7684\u3002\u5982\u679c\u662fwindows\u7684\u8bdd\uff0c\u6709\u5f88\u591a\u7684\u8f6f\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u5168\u5c40\u7684\u4ee3\u7406\uff0c\u4f46\u662fLinux\u4e0b\u6ca1\u6709\u7c7b\u4f3c\u7684\u8f6f\u4ef6\uff0c\u8fd9\u91cc\u603b\u7ed3\u4e86\u4e00\u4e0bLinux\u4e0b\u7684\u4e00\u4e9b\u7528\u6cd5\u3002 \u4e00\u3001curl \u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668 curl\u662fLinux\u6700\u5e38\u7528\u7684\u547d\u4ee4\uff0c\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a \u65b9\u6cd5\u4e00\u3001curl\u547d\u4ee4\u884c\u76f4\u63a5\u6307\u5b9a\u4ee3\u7406 # \u53c2\u6570\u662f-x, –proxy [protocol:\/\/]host[:port] curl -x “socks5h:\/\/172.28.9.46:10801” https:\/\/myip.ipip.net\/ #\u5982\u679c\u4e0d\u6307\u5b9a\u534f\u8bae\u7684\u8bdd\u9ed8\u8ba4\u662fHTTP\u534f\u8bae curl -x 172.28.9.46:10802 https:\/\/myip.ipip.net\/ curl 7.21\u7248\u672c\u5f00\u59cb\u652f\u6301\u4ee3\u7406\u534f\u8bae\u7684\u6307\u5b9a\uff0c7.52\u7248\u672c\u5f00\u59cb\u652f\u6301https\u534f\u8bae\u7684\u4ee3\u7406\u3002 \u65b9\u6cd5\u4e8c\u3001\u914d\u7f6e\u6587\u4ef6(~\/.curlrc)\u8bbe\u7f6e\u4ee3\u7406\u670d\u52a1\u5668 # cat ~\/.curlrc proxy = “socks5h:\/\/172.28.9.46:10801” \u4e8c\u3001\u5168\u5c40\u6027\u4ee3\u7406\u914d\u7f6e \u4e0a\u9762\u53ea\u4ecb\u7ecd\u4e86curl\u547d\u4ee4\uff0c\u5f88\u591a\u65f6\u5019\u6211\u4eec\u60f3\u8981\u4e00\u4e2a\u5168\u5c40\u6027\u4ee3\u7406\uff0c\u90a3\u4e48\u9700\u8981\u6309\u7167\u4e0b\u9762\u65b9\u6cd5\uff1a \u6dfb\u52a0\u4ee5\u4e0b\u73af\u5883\u53d8\u91cf export http_proxy=http:\/\/172.28.9.46:10802 export https_proxy=$http_proxy export ftp_proxy=$http_proxy export rsync_proxy=$http_proxy export all_proxy=$http_proxy export no_proxy=*.abc.com,10.*.*.*,192.168.*.*,*.local,localhost,127.0.0.1 \u8fd9\u91cc\u9700\u8981\u89e3\u91ca\u4e0b\uff1a http_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662fHTTP\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b https_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662fHTTPS\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b ftp_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662fFTP\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b rsync_proxy\uff1a\u5f53\u8bbf\u95ee\u7684\u662frsync\u534f\u8bae\u65f6\uff0c\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740\uff1b all_proxy\uff1a \u5176\u4ed6\u534f\u8bae\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u5730\u5740 no_proxy\uff1a\u4e0d\u4f7f\u7528\u4ee3\u7406\u7684\u4e3b\u673a\u6216IP\u3002 \u4f8b\u5982 #\u4ec5\u8bbe\u7f6e\u8bbf\u95eehttp\u534f\u8bae\u65f6\u4f7f\u7528\u4ee3\u7406 [root@s101.ipcpu.com […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[17,231],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1594"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=1594"}],"version-history":[{"count":1,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1594\/revisions"}],"predecessor-version":[{"id":1595,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1594\/revisions\/1595"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=1594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=1594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=1594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}