{"id":222,"date":"2015-04-26T14:29:36","date_gmt":"2015-04-26T06:29:36","guid":{"rendered":"http:\/\/www.tienkang.space\/?p=222"},"modified":"2025-10-31T18:18:42","modified_gmt":"2025-10-31T10:18:42","slug":"shadowsocks-python%e7%89%88%e4%b8%80%e9%94%ae%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/tienkang.space\/?p=222","title":{"rendered":"Shadowsocks Python\u7248\u4e00\u952e\u5b89\u88c5\u811a\u672c"},"content":{"rendered":"<div class=\"entry-content\">\n<p><a href=\"http:\/\/teddysun.com\/342.html\"><div class=\"photoview\"><img decoding=\"async\" class=\"aligncenter\" title=\"CentOS\u4e0bshadowsocks\u4e00\u952e\u5b89\u88c5\u811a\u672c\" data-echo=\"https:\/\/dn-teddysun.qbox.me\/wp-content\/uploads\/2014\/shadowsocks.png\" data-jslghtbx=\"https:\/\/dn-teddysun.qbox.me\/wp-content\/uploads\/2014\/shadowsocks.png\" class=\"view\" data-jslghtbx-group=\"group\" src=\"https:\/\/tienkang.space\/wp-content\/themes\/Rizhi\/img\/load.gif\" alt=\"\" \/><\/a><\/p><\/div>\n<p><b>\u672c\u811a\u672c\u9002\u7528\u73af\u5883\uff1a<\/b><br \/>\n\u7cfb\u7edf\u652f\u6301\uff1aCentOS 6,7\uff0cDebian\uff0cUbuntu<br \/>\n\u5185\u5b58\u8981\u6c42\uff1a\u2265128M<br \/>\n\u65e5\u671f\uff1a2015\u5e7403\u670810\u65e5<\/p>\n<p><b>\u5173\u4e8e\u672c\u811a\u672c\uff1a<\/b><br \/>\n\u4e00\u952e\u5b89\u88c5 Python \u7248 shadowsocks \u7684\u6700\u65b0\u7248\uff0c\u540c\u65f6\u5b89\u88c5\u4e86 Python \u5305\u7ba1\u7406\u5de5\u5177 pip\u3002<br \/>\n<strong>\u53cb\u60c5\u63d0\u793a\uff1a\u5982\u679c\u4f60\u6709\u95ee\u9898\uff0c\u8bf7\u5148\u53c2\u8003\u8fd9\u7bc7\u300a<a href=\"http:\/\/teddysun.com\/399.html\" target=\"_blank\">Shadowsocks Troubleshooting<\/a>\u300b\u540e\u518d\u95ee\u3002<\/strong><\/p>\n<p><b>\u9ed8\u8ba4\u914d\u7f6e\uff1a<\/b><br \/>\n\u670d\u52a1\u5668\u7aef\u53e3\uff1a8989<br \/>\n\u5ba2\u6237\u7aef\u7aef\u53e3\uff1a1080<br \/>\n\u5bc6\u7801\uff1a\u81ea\u5df1\u8bbe\u5b9a\uff08\u5982\u4e0d\u8bbe\u5b9a\uff0c\u9ed8\u8ba4\u4e3ateddysun.com\uff09<br \/>\n\u5907\u6ce8\uff1a\u811a\u672c\u9ed8\u8ba4\u521b\u5efa\u5355\u7528\u6237\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\u9700\u914d\u7f6e\u591a\u7528\u6237\uff0c\u5b89\u88c5\u5b8c\u6bd5\u540e\u53c2\u7167\u4e0b\u9762\u7684\u6559\u7a0b sample \u624b\u52a8\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u540e\u91cd\u542f\u5373\u53ef\u3002<\/p>\n<p><b>\u5ba2\u6237\u7aef\u4e0b\u8f7d\uff1a<\/b><br \/>\n<a href=\"http:\/\/sourceforge.net\/projects\/shadowsocksgui\/files\/dist\/\" target=\"_blank\">http:\/\/sourceforge.net\/projects\/shadowsocksgui\/files\/dist\/<\/a><\/p>\n<p><b>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/b><br \/>\n\u4f7f\u7528root\u7528\u6237\u767b\u5f55\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre class=\"prettyprint lang-bsh\">wget --no-check-certificate https:\/\/raw.githubusercontent.com\/teddysun\/shadowsocks_install\/master\/shadowsocks.sh\r\nchmod +x shadowsocks.sh\r\n.\/shadowsocks.sh 2&gt;&amp;1 | tee shadowsocks.log<\/pre>\n<p><b>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u811a\u672c\u63d0\u793a\u5982\u4e0b\uff1a<\/b><\/p>\n<pre class=\"prettyprint lang-bsh\">Congratulations, shadowsocks install completed!\r\nYour Server IP:your_server_ip\r\nYour Server Port:8989\r\nYour Password:your_password\r\nYour Local IP:127.0.0.1\r\nYour Local Port:1080\r\nYour Encryption Method:aes-256-cfb\r\n\r\nWelcome to visit:http:\/\/teddysun.com\/342.html\r\nEnjoy it!<\/pre>\n<p><b>\u5378\u8f7d\u65b9\u6cd5\uff1a<\/b><br \/>\n\u4f7f\u7528root\u7528\u6237\u767b\u5f55\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre class=\"prettyprint lang-bsh\">.\/shadowsocks.sh uninstall<\/pre>\n<p><b>\u5355\u7528\u6237\u914d\u7f6e\u6587\u4ef6sample\uff082015\u5e7401\u670821\u65e5\u4fee\u6b63\uff09\uff1a<\/b><br \/>\n\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\uff1a\/etc\/shadowsocks.json<\/p>\n<pre class=\"prettyprint\">{\r\n    \"server\":\"your_server_ip\",\r\n    \"server_port\":8989,\r\n    \"local_address\":\"127.0.0.1\",\r\n    \"local_port\":1080,\r\n    \"password\":\"yourpassword\",\r\n    \"timeout\":300,\r\n    \"method\":\"aes-256-cfb\",\r\n    \"fast_open\": false\r\n}<\/pre>\n<p><b>\u591a\u7528\u6237\u591a\u7aef\u53e3\u914d\u7f6e\u6587\u4ef6 sample\uff082015\u5e7401\u670821\u65e5\u4fee\u6b63\uff09\uff1a<\/b><br \/>\n\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\uff1a\/etc\/shadowsocks.json<\/p>\n<pre class=\"prettyprint\">{\r\n    \"server\":\"your_server_ip\",\r\n    \"local_address\":\"127.0.0.1\",\r\n    \"local_port\":1080,\r\n    \"port_password\":{\r\n         \"8989\":\"password0\",\r\n         \"9001\":\"password1\",\r\n         \"9002\":\"password2\",\r\n         \"9003\":\"password3\",\r\n         \"9004\":\"password4\"\r\n    },\r\n    \"timeout\":300,\r\n    \"method\":\"aes-256-cfb\",\r\n    \"fast_open\": false\r\n}<\/pre>\n<p><b>\u4f7f\u7528\u547d\u4ee4\uff082015\u5e7401\u670821\u65e5\u4fee\u6b63\uff09\uff1a<\/b><br \/>\n\u542f\u52a8\uff1a\/etc\/init.d\/shadowsocks start<br \/>\n\u505c\u6b62\uff1a\/etc\/init.d\/shadowsocks stop<br \/>\n\u91cd\u542f\uff1a\/etc\/init.d\/shadowsocks restart<br \/>\n\u72b6\u6001\uff1a\/etc\/init.d\/shadowsocks status<\/p>\n<p><b>\u66f4\u591a\u7248\u672c shadowsocks \u5b89\u88c5\uff1a<\/b><br \/>\n<a href=\"http:\/\/teddysun.com\/357.html\">CentOS \u4e0b Shadowsocks-libev \u4e00\u952e\u5b89\u88c5\u811a\u672c<\/a><br \/>\n<a href=\"http:\/\/teddysun.com\/358.html\">Debian \u4e0b Shadowsocks-libev \u4e00\u952e\u5b89\u88c5\u811a\u672c<\/a><br \/>\n<a href=\"http:\/\/teddysun.com\/392.html\">Shadowsocks-go \u4e00\u952e\u5b89\u88c5\u811a\u672c\uff08CentOS\uff0cDebian\uff0cUbuntu\uff09<\/a><\/p>\n<p><b>\u53c2\u8003\u94fe\u63a5\uff1a<\/b><br \/>\n<a href=\"http:\/\/teddysun.com\/339.html\">http:\/\/teddysun.com\/339.html<\/a><\/p>\n<p><b>\u66f4\u65b0\u65e5\u5fd7\uff1a<\/b><br \/>\n\uff082015\u5e7403\u670810\u65e5\uff09<br \/>\n1\u3001\u65b0\u589e\u5728 Debian\u3001Ubuntu \u4e0b\u7684\u4e00\u952e\u5b89\u88c5\uff1b<br \/>\n\uff082015\u5e7401\u670821\u65e5\uff09<br \/>\n1\u3001\u4fee\u6b63\u914d\u7f6e\u6587\u4ef6\uff0c\u4e0e\u5b98\u65b9\u7ed9\u51fa\u7684 sample \u4e00\u81f4\uff1b<br \/>\n2\u3001\u4fee\u6539\u542f\u52a8\u811a\u672c\uff0c\u4f7f\u7528\u5b98\u65b9\u7ed9\u51fa\u7684\u540e\u53f0\u542f\u52a8\u548c\u505c\u6b62\u547d\u4ee4\u3002<br \/>\n\uff082014\u5e7410\u670810\u65e5\uff09<br \/>\n\u8ddf\u4f5c\u8005<a href=\"https:\/\/github.com\/clowwindy\/shadowsocks\/issues\/195\" target=\"_blank\">\u53cd\u9988<\/a>\u4e86\u591a\u7528\u6237\u591a\u7aef\u53e3\u95ee\u9898\uff0c\u4f5c\u8005\u5df2\u66f4\u65b0 <a href=\"https:\/\/github.com\/clowwindy\/shadowsocks\/wiki\/Configure-Multiple-Users\" target=\"_blank\">Wiki \u9875\u9762<\/a>\u3002\u672c\u6559\u7a0b\u65b0\u589e\u591a\u7528\u6237\u591a\u7aef\u53e3\u914d\u7f6e\u6587\u4ef6\u7684 sample \u3002<br \/>\n\uff082014\u5e7409\u670824\u65e5\uff09<br \/>\n\u5982\u4f55\u914d\u7f6e\u591a\u7528\u6237\uff1f\u8be6\u89c1\uff1a<a href=\"https:\/\/github.com\/clowwindy\/shadowsocks\/wiki\/Configure-Multiple-Users\" target=\"_blank\">\u8fd9\u91cc<\/a><br \/>\n\u5907\u6ce8\uff1aShadowsocks \u5df2\u7ecf\u652f\u6301\u591a\u7528\u6237\uff0c\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u589e\u52a0\u4e0d\u540c\u7684\u7aef\u53e3\uff0c\u5bf9\u5e94\u4e0d\u540c\u7684\u5bc6\u7801\u5373\u53ef\u3002<br \/>\n\uff082014\u5e7409\u670818\u65e5\uff09<br \/>\n1\u3001\u5b89\u88c5\u5b8c\u6210\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u5347\u7ea7\u5230\u6700\u65b0\u7248\u672c\u3002<\/p>\n<pre class=\"prettyprint lang-bsh\">pip install -U shadowsocks<\/pre>\n<p>\u6ce8\u610f\u5347\u7ea7\u5b8c\u6210\u540e\u9700\u8981\u518d\u91cd\u542f\u4e00\u4e0b\u3002<br \/>\n\uff082014\u5e7407\u670812\u65e5\uff09<br \/>\n1\u3001\u4fee\u6b63\u83b7\u53d6\u516c\u7f51 IP \u65f6\u7684\u4e00\u4e2a\u95ee\u9898\u3002\u5efa\u8bae\u4e0d\u8981\u4f7f\u7528\u5171\u4eab\u516c\u7f51 IP \u7684 VPS \u6765\u642d\u5efa Shadowsocks \u670d\u52a1\u3002<br \/>\n\uff082014\u5e7405\u670829\u65e5\uff09<br \/>\n1\u3001\u589e\u52a0 chkconfig \u914d\u7f6e\uff0c\u5b9e\u73b0 service \u547d\u4ee4\u3002<br \/>\n2\u3001\u914d\u7f6e\u6587\u4ef6\u540d\u4ece \/etc\/config.json \u6539\u4e3a \/etc\/shadowsocks.json\uff08\u4e0e\u5b98\u65b9\u7684\u547d\u540d\u4e00\u81f4\uff09\u3002<br \/>\n3\u3001\u914d\u7f6e\u6587\u4ef6\u4e2d\u65b0\u589e workers \uff0c\u503c\u9ed8\u8ba4\u4e3a 1\uff08\u4e0e\u5b98\u65b9\u914d\u7f6e\u540c\u6b65\uff09\u3002<br \/>\n\uff082014\u5e7405\u670827\u65e5\uff09<br \/>\n1\u3001\u4fee\u6b63\u5f00\u673a\u81ea\u542f\u52a8\u5931\u6548\u7684\u95ee\u9898\u3002<br \/>\n2\u3001\u4f18\u5316\u662f\u5426\u540e\u53f0\u542f\u52a8\u6210\u529f\u7684\u5224\u65ad\u903b\u8f91\u3002<br \/>\n\uff082014\u5e7405\u670804\u65e5\uff09<br \/>\n1\u3001\u4fee\u6b63\u5bf9\u589e\u52a0\u9632\u706b\u5899\u7aef\u53e3\u903b\u8f91\u7684\u5224\u65adbug\uff0c\u5bf9\u4e8e\u5df2\u7ecf\u653e\u884c 8989 \u7aef\u53e3\u7684\u60c5\u51b5\u4e0b\uff0c\u5219\u65e0\u9700\u518d\u6b21\u589e\u52a0\u3002<br \/>\n2\u3001\u4fee\u6b63\u83b7\u53d6\u670d\u52a1\u5668 IP \u7684\u5224\u65adbug\uff0c\u5bf9\u4e8e\u591a IP \u7684 VPS \u6216\u670d\u52a1\u5668\uff0c\u9ed8\u8ba4\u53ea\u53d6\u7b2c\u4e00\u4e2a\u516c\u7f51 IP \u5199\u5230\u914d\u7f6e\u6587\u4ef6\uff08\/etc\/config.json\uff09\u91cc\u3002<br \/>\n3\u3001\u52a0\u5165\u5f00\u673a\u81ea\u542f\u52a8\u3002<\/p>\n<p><b>\u7279\u522b\u8bf4\u660e\uff1a<\/b><br \/>\n1\u3001\u5df2\u5b89\u88c5\u65e7\u7248\u672c\u7684 shadowsocks \u9700\u8981\u5347\u7ea7\u7684\u8bdd\uff0c\u76f4\u63a5\u8fd0\u884c pip install -U shadowsocks \u5373\u53ef\uff0c\u5347\u7ea7\u5b8c\u6210\u540e\u9700\u91cd\u542f\u3002<br \/>\n2\u3001\u5173\u4e8e CentOS \u7684\u9ed8\u8ba4 iptables \u9632\u706b\u5899\u89c4\u5219 icmp-host-prohibited \uff0c\u5982\u679c\u5b89\u88c5\u4e4b\u540e\u53d1\u73b0\u5df2\u7ecf\u542f\u52a8 shadowsocks\uff0c\u672c\u5730\u5ba2\u6237\u7aef\u5374\u4e0d\u80fd\u8fde\u63a5\u4e0a\uff0c\u8bf7\u68c0\u67e5 iptables \u662f\u4e0d\u662f\u6709\u5982\u4e0b\u7684\u4e00\u6761\u89c4\u5219\uff1a<\/p>\n<pre class=\"prettyprint lang-bsh\">REJECT     all  --  0.0.0.0\/0            0.0.0.0\/0           reject-with icmp-host-prohibited<\/pre>\n<p>\u8fd0\u884c\u547d\u4ee4\uff1a<\/p>\n<pre class=\"prettyprint lang-bsh\">\/etc\/init.d\/iptables status<\/pre>\n<p>\u5982\u679c\u6709\u8fd9\u6761\u89c4\u5219\u7684\u8bdd\uff0c\u5219\u6dfb\u52a0\u7684 8989 \u7aef\u53e3\u9700\u624b\u52a8\u66f4\u6539\u4e00\u4e0b\uff0c\u653e\u5230\u8fd9\u6761\u89c4\u5219\u7684\u4e0a\u4e00\u884c\u3002\u7f16\u8f91 \/etc\/sysconfig\/iptables \u6587\u4ef6\uff0c\u5c06\uff1a<\/p>\n<pre class=\"prettyprint lang-bsh\">-A INPUT -p tcp -m state --state NEW -m tcp --dport 8989 -j ACCEPT<\/pre>\n<p>\u653e\u5728\uff1a<\/p>\n<pre class=\"prettyprint lang-bsh\">-A INPUT -j REJECT --reject-with icmp-host-prohibited<\/pre>\n<p>\u7684\u524d\u9762\u3002\u6700\u7ec8\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<pre class=\"prettyprint lang-bsh\">-A INPUT -p tcp -m state --state NEW -m tcp --dport 8989 -j ACCEPT\r\n-A INPUT -j REJECT --reject-with icmp-host-prohibited<\/pre>\n<p>\u7f16\u8f91\u5b8c\u540e\uff0c\u91cd\u542f iptables \u9632\u706b\u5899\u3002\u547d\u4ee4\uff1a\/etc\/init.d\/iptables restart<\/p>\n<p>\u8f6c\u8f7d\u4e8e\uff1ahttp:\/\/teddysun.com\/342.html<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u811a\u672c\u9002\u7528\u73af\u5883\uff1a \u7cfb\u7edf\u652f\u6301\uff1aCentOS 6,7\uff0cDebian\uff0cUbuntu \u5185\u5b58\u8981\u6c42\uff1a\u2265128M \u65e5\u671f\uff1a20 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[52],"tags":[53],"class_list":["post-222","post","type-post","status-publish","format-standard","hentry","category-52","tag-linux"],"_links":{"self":[{"href":"https:\/\/tienkang.space\/index.php?rest_route=\/wp\/v2\/posts\/222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tienkang.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tienkang.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tienkang.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tienkang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=222"}],"version-history":[{"count":1,"href":"https:\/\/tienkang.space\/index.php?rest_route=\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":634,"href":"https:\/\/tienkang.space\/index.php?rest_route=\/wp\/v2\/posts\/222\/revisions\/634"}],"wp:attachment":[{"href":"https:\/\/tienkang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tienkang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tienkang.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}