{"id":54070,"date":"2025-02-18T10:25:55","date_gmt":"2025-02-18T02:25:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/54070\/"},"modified":"2025-02-18T10:25:55","modified_gmt":"2025-02-18T02:25:55","slug":"openwrt%e4%b8%8a%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8xray%e7%9a%84%e5%85%a8%e9%9d%a2%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/54070\/","title":{"rendered":"OpenWrt\u4e0a\u5b89\u88c5\u548c\u4f7f\u7528Xray\u7684\u5168\u9762\u6307\u5357"},"content":{"rendered":"<p>\u5728\u73b0\u4ee3\u7f51\u7edc\u73af\u5883\u4e2d\uff0c\u7f51\u7edc\u5b89\u5168\u548c\u9690\u79c1\u65e5\u76ca\u91cd\u8981\u3002<em>Xray<\/em>\u4f5c\u4e3a\u4e00\u6b3e\u4f18\u79c0\u7684\u4ee3\u7406\u5de5\u5177\uff0c\u7ed3\u5408\u4e86<em>OpenWrt<\/em>\u7cfb\u7edf\uff0c\u80fd\u591f\u6709\u6548\u63d0\u5347\u7f51\u7edc\u7684\u5b89\u5168\u6027\u548c\u533f\u540d\u6027\u3002\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8\u5982\u4f55\u5728OpenWrt\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eXray\uff0c\u5e76\u63d0\u4f9b\u4f7f\u7528\u4e2d\u7684\u4e00\u4e9b\u6700\u4f73\u5b9e\u8df5\u548c\u5e38\u89c1\u95ee\u9898\u89e3\u7b54\u3002<\/p>\n<h2>1. \u4ec0\u4e48\u662fOpenWrt\uff1f<\/h2>\n<p><em>OpenWrt<\/em>\u662f\u4e00\u4e2a\u57fa\u4e8eLinux\u7684\u8def\u7531\u5668\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u5bb6\u5ead\u548c\u4f01\u4e1a\u7f51\u7edc\u4e2d\u3002\u5b83\u7684\u53ef\u5b9a\u5236\u6027\u548c\u5f00\u6e90\u7279\u6027\uff0c\u4f7f\u5f97\u7528\u6237\u80fd\u591f\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u5bf9\u8def\u7531\u5668\u8fdb\u884c\u6df1\u5ea6\u5b9a\u5236\u548c\u529f\u80fd\u6269\u5c55\u3002<\/p>\n<h3>1.1 OpenWrt\u7684\u4f18\u52bf<\/h3>\n<ul>\n<li><strong>\u7075\u6d3b\u6027<\/strong>\uff1a\u7528\u6237\u53ef\u4ee5\u5b89\u88c5\u4e0d\u540c\u7684\u5305\u4ee5\u6ee1\u8db3\u7279\u5b9a\u9700\u6c42\u3002<\/li>\n<li><strong>\u5b89\u5168\u6027<\/strong>\uff1a\u5b9a\u671f\u66f4\u65b0\u548c\u793e\u533a\u652f\u6301\u8ba9\u5b89\u5168\u6027\u6709\u4fdd\u969c\u3002<\/li>\n<li><strong>\u6027\u80fd<\/strong>\uff1a\u901a\u8fc7\u5408\u7406\u914d\u7f6e\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u7f51\u7edc\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h2>2. \u4ec0\u4e48\u662fXray\uff1f<\/h2>\n<p><em>Xray<\/em>\u662f\u4e00\u4e2a\u7f51\u7edc\u4ee3\u7406\u5de5\u5177\uff0c\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u79d1\u5b66\u4e0a\u7f51\uff0c\u6253\u7834\u5730\u57df\u9650\u5236\uff0c\u5e76\u4fdd\u62a4\u7f51\u7edc\u9690\u79c1\u3002\u5b83\u652f\u6301\u591a\u79cd\u534f\u8bae\uff0c\u5305\u62ecVMess\u3001Shadowsocks\u7b49\uff0c\u63d0\u4f9b\u591a\u79cd\u52a0\u5bc6\u65b9\u5f0f\uff0c\u63d0\u5347\u6570\u636e\u4f20\u8f93\u7684\u5b89\u5168\u6027\u3002<\/p>\n<h3>2.1 Xray\u7684\u4e3b\u8981\u7279\u6027<\/h3>\n<ul>\n<li><strong>\u591a\u534f\u8bae\u652f\u6301<\/strong>\uff1a\u53ef\u6839\u636e\u9700\u8981\u9009\u62e9\u4e0d\u540c\u7684\u4ee3\u7406\u534f\u8bae\u3002<\/li>\n<li><strong>\u591a\u7528\u6237\u652f\u6301<\/strong>\uff1a\u80fd\u591f\u7ba1\u7406\u591a\u4e2a\u7528\u6237\u7684\u7f51\u7edc\u8bf7\u6c42\u3002<\/li>\n<li><strong>\u53ef\u6269\u5c55\u6027<\/strong>\uff1a\u652f\u6301\u63d2\u4ef6\u6269\u5c55\uff0c\u589e\u5f3a\u529f\u80fd\u3002<\/li>\n<\/ul>\n<h2>3. \u5728OpenWrt\u4e0a\u5b89\u88c5Xray\u7684\u6b65\u9aa4<\/h2>\n<p>\u4e3a\u4e86\u5728<em>OpenWrt<\/em>\u4e0a\u6210\u529f\u5b89\u88c5<em>Xray<\/em>\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<h3>3.1 \u51c6\u5907\u5de5\u4f5c<\/h3>\n<ul>\n<li><strong>\u786e\u4fdd\u8def\u7531\u5668\u4e0a\u5df2\u5b89\u88c5OpenWrt<\/strong>\uff0c\u5e76\u53ef\u8bbf\u95ee\u8def\u7531\u5668\u7ba1\u7406\u754c\u9762\u3002<\/li>\n<li><strong>\u5907\u4efd\u5f53\u524d\u914d\u7f6e<\/strong>\uff0c\u4ee5\u9632\u51fa\u73b0\u95ee\u9898\u65f6\u80fd\u591f\u5feb\u901f\u6062\u590d\u3002<\/li>\n<\/ul>\n<h3>3.2 \u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u5305<\/h3>\n<p>\u5728SSH\u4e2d\u8fde\u63a5\u5230\u8def\u7531\u5668\u540e\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u5b89\u88c5\u4f9d\u8d56\uff1a bash opkg update opkg install curl wget<\/p>\n<h3>3.3 \u4e0b\u8f7dXray<\/h3>\n<p>\u63a5\u4e0b\u6765\uff0c\u9700\u8981\u4e0b\u8f7dXray\u7684\u6700\u65b0\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a bash cd \/tmp wget https:\/\/github.com\/XTLS\/Xray-core\/releases\/latest\/download\/Xray-linux-arm64.zip<\/p>\n<h3>3.4 \u89e3\u538b\u5e76\u5b89\u88c5Xray<\/h3>\n<p>\u89e3\u538b\u4e0b\u8f7d\u7684\u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u79fb\u52a8\u5230\u5408\u9002\u7684\u76ee\u5f55\uff1a bash unzip Xray-linux-arm64.zip -d \/usr\/local\/bin\/ chmod +x \/usr\/local\/bin\/xray<\/p>\n<h3>3.5 \u914d\u7f6eXray<\/h3>\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u914d\u7f6e\u6587\u4ef6\uff1a bash mkdir -p \/etc\/xray vi \/etc\/xray\/config.json<\/p>\n<p>\u5728\u6b64\u6587\u4ef6\u4e2d\u6dfb\u52a0\u57fa\u672c\u7684\u914d\u7f6e\u9879\uff0c\u6839\u636e\u4f60\u7684\u7f51\u7edc\u9700\u6c42\u8fdb\u884c\u76f8\u5e94\u4fee\u6539\u3002<\/p>\n<h3>3.6 \u542f\u52a8Xray<\/h3>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Xray\uff1a bash xray run -config \/etc\/xray\/config.json<\/p>\n<h3>3.7 \u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<\/h3>\n<p>\u4e3a\u4e86\u8ba9Xray\u5728\u8def\u7531\u5668\u91cd\u542f\u540e\u81ea\u52a8\u542f\u52a8\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a bash echo \u2018\/usr\/local\/bin\/xray run -config \/etc\/xray\/config.json &amp;\u2019 &gt;&gt; \/etc\/rc.local chmod +x \/etc\/rc.local<\/p>\n<h2>4. Xray\u7684\u57fa\u672c\u4f7f\u7528<\/h2>\n<p>\u4e00\u65e6\u6210\u529f\u5b89\u88c5\u5e76\u542f\u52a8Xray\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528\u4e86\u3002\u6839\u636e\u5177\u4f53\u9700\u6c42\uff0c\u53ef\u4ee5\u5728\u8bbe\u5907\u4e0a\u914d\u7f6e\u4ee3\u7406\u670d\u52a1\uff0c\u5b9e\u73b0\u79d1\u5b66\u4e0a\u7f51\u3002<\/p>\n<h3>4.1 \u5ba2\u6237\u7aef\u914d\u7f6e<\/h3>\n<p>\u5728\u7ec8\u7aef\u6216\u6d4f\u89c8\u5668\u4e2d\u914d\u7f6e\u4ee3\u7406\uff0c\u4f7f\u5176\u6307\u5411\u8def\u7531\u5668\u7684IP\u5730\u5740\u548cXray\u670d\u52a1\u7aef\u53e3\u3002<\/p>\n<h2>5. \u4f18\u5316Xray\u914d\u7f6e<\/h2>\n<ul>\n<li><strong>\u8c03\u6574\u8fde\u63a5\u6570<\/strong>\uff1a\u6839\u636e\u5b9e\u9645\u5e26\u5bbd\u8fdb\u884c\u5408\u7406\u8bbe\u7f6e\uff0c\u9632\u6b62\u8fde\u63a5\u6570\u8fc7\u591a\u5bfc\u81f4\u7f51\u7edc\u62e5\u5835\u3002<\/li>\n<li><strong>\u4f7f\u7528CDN\u52a0\u901f<\/strong>\uff1a\u53ef\u4ee5\u901a\u8fc7CDN\u52a0\u901f\u964d\u4f4e\u5ef6\u8fdf\uff0c\u63d0\u9ad8\u8bbf\u95ee\u901f\u5ea6\u3002<\/li>\n<\/ul>\n<h2>6. \u5e38\u89c1\u95ee\u9898\u89e3\u7b54<\/h2>\n<h3>6.1 Xray\u65e0\u6cd5\u542f\u52a8\u600e\u4e48\u529e\uff1f<\/h3>\n<ul>\n<li>\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u786e\u4fdd\u5404\u9879\u53c2\u6570\u6b63\u786e\u3002<\/li>\n<li>\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\uff0c\u786e\u8ba4\u662f\u5426\u6709\u62a5\u9519\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<h3>6.2 OpenWrt\u652f\u6301\u54ea\u4e9b\u7248\u672c\u7684Xray\uff1f<\/h3>\n<ul>\n<li>OpenWrt\u652f\u6301\u591a\u4e2aXray\u7248\u672c\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7a33\u5b9a\u7248\u672c\u3002<\/li>\n<\/ul>\n<h3>6.3 \u5982\u4f55\u67e5\u770bXray\u7684\u8fd0\u884c\u72b6\u6001\uff1f<\/h3>\n<ul>\n<li>\u53ef\u4ee5\u901a\u8fc7SSH\u8fde\u63a5\u5230\u8def\u7531\u5668\uff0c\u4f7f\u7528\u547d\u4ee4 <code>ps | grep xray<\/code> \u67e5\u770b\u8fdb\u7a0b\u662f\u5426\u5728\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<h3>6.4 \u5982\u4f55\u5b89\u5168\u5730\u505c\u6b62Xray\uff1f<\/h3>\n<ul>\n<li>\u4f7f\u7528\u547d\u4ee4 <code>killall xray<\/code> \u53ef\u4ee5\u5b89\u5168\u5730\u505c\u6b62Xray\u670d\u52a1\u3002<\/li>\n<\/ul>\n<h2>7. \u603b\u7ed3<\/h2>\n<p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5728<em>OpenWrt<\/em>\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e<em>Xray<\/em>\u7684\u5168\u8fc7\u7a0b\uff0c\u5305\u62ec\u5404\u9879\u6b65\u9aa4\u548c\u5e38\u89c1\u95ee\u9898\u7684\u89e3\u7b54\u3002\u901a\u8fc7\u7ed3\u5408\u8fd9\u4e24\u8005\uff0c\u53ef\u4ee5\u63d0\u5347\u7f51\u7edc\u7684\u5b89\u5168\u6027\u548c\u4f7f\u7528\u4f53\u9a8c\u3002\u5e0c\u671b\u672c\u6307\u5357\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u66f4\u597d\u5730\u5229\u7528<em>OpenWrt<\/em>\u548c<em>Xray<\/em>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u73b0\u4ee3\u7f51\u7edc\u73af\u5883\u4e2d\uff0c\u7f51\u7edc\u5b89\u5168\u548c\u9690\u79c1\u65e5\u76ca\u91cd\u8981\u3002Xray\u4f5c\u4e3a\u4e00\u6b3e\u4f18\u79c0\u7684\u4ee3\u7406\u5de5\u5177\uff0c\u7ed3\u5408\u4e86OpenWrt\u7cfb\u7edf\uff0c\u80fd\u591f\u6709\u6548\u63d0\u5347\u7f51\u7edc\u7684\u5b89\u5168\u6027\u548c\u533f\u540d\u6027\u3002\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8\u5982\u4f55\u5728OpenWrt\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eXray\uff0c\u5e76\u63d0\u4f9b\u4f7f\u7528\u4e2d\u7684\u4e00\u4e9b\u6700\u4f73\u5b9e\u8df5\u548c\u5e38\u89c1\u95ee\u9898\u89e3\u7b54\u3002 1. \u4ec0\u4e48\u662fOpenWrt\uff1f OpenWrt\u662f\u4e00\u4e2a\u57fa\u4e8eLinux\u7684\u8def\u7531\u5668\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u5bb6\u5ead\u548c\u4f01\u4e1a\u7f51\u7edc\u4e2d\u3002\u5b83\u7684\u53ef\u5b9a\u5236\u6027\u548c\u5f00\u6e90\u7279\u6027\uff0c\u4f7f\u5f97\u7528\u6237\u80fd\u591f\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u5bf9\u8def\u7531\u5668\u8fdb\u884c\u6df1\u5ea6\u5b9a\u5236\u548c\u529f\u80fd\u6269\u5c55\u3002 1.1 OpenWrt\u7684\u4f18\u52bf \u7075\u6d3b\u6027\uff1a\u7528\u6237\u53ef\u4ee5\u5b89\u88c5\u4e0d\u540c\u7684\u5305\u4ee5\u6ee1\u8db3\u7279\u5b9a\u9700\u6c42\u3002 \u5b89\u5168\u6027\uff1a\u5b9a\u671f\u66f4\u65b0\u548c\u793e\u533a\u652f\u6301\u8ba9\u5b89\u5168\u6027\u6709\u4fdd\u969c\u3002 \u6027\u80fd\uff1a\u901a\u8fc7\u5408\u7406\u914d\u7f6e\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u5347\u7f51\u7edc\u6027\u80fd\u3002 2. \u4ec0\u4e48\u662fXray\uff1f Xray\u662f\u4e00\u4e2a\u7f51\u7edc\u4ee3\u7406\u5de5\u5177\uff0c\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u79d1\u5b66\u4e0a\u7f51\uff0c\u6253\u7834\u5730\u57df\u9650\u5236\uff0c\u5e76\u4fdd\u62a4\u7f51\u7edc\u9690\u79c1\u3002\u5b83\u652f\u6301\u591a\u79cd\u534f\u8bae\uff0c\u5305\u62ecVMess\u3001Shadowsocks\u7b49\uff0c\u63d0\u4f9b\u591a\u79cd\u52a0\u5bc6\u65b9\u5f0f\uff0c\u63d0\u5347\u6570\u636e\u4f20\u8f93\u7684\u5b89\u5168\u6027\u3002 2.1 Xray\u7684\u4e3b\u8981\u7279\u6027 \u591a\u534f\u8bae\u652f\u6301\uff1a\u53ef\u6839\u636e\u9700\u8981\u9009\u62e9\u4e0d\u540c\u7684\u4ee3\u7406\u534f\u8bae\u3002 \u591a\u7528\u6237\u652f\u6301\uff1a\u80fd\u591f\u7ba1\u7406\u591a\u4e2a\u7528\u6237\u7684\u7f51\u7edc\u8bf7\u6c42\u3002 \u53ef\u6269\u5c55\u6027\uff1a\u652f\u6301\u63d2\u4ef6\u6269\u5c55\uff0c\u589e\u5f3a\u529f\u80fd\u3002 3. \u5728OpenWrt\u4e0a\u5b89\u88c5Xray\u7684\u6b65\u9aa4 \u4e3a\u4e86\u5728OpenWrt\u4e0a\u6210\u529f\u5b89\u88c5Xray\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a 3.1 \u51c6\u5907\u5de5\u4f5c \u786e\u4fdd\u8def\u7531\u5668\u4e0a\u5df2\u5b89\u88c5OpenWrt\uff0c\u5e76\u53ef\u8bbf\u95ee\u8def\u7531\u5668\u7ba1\u7406\u754c\u9762\u3002 \u5907\u4efd\u5f53\u524d\u914d\u7f6e\uff0c\u4ee5\u9632\u51fa\u73b0\u95ee\u9898\u65f6\u80fd\u591f\u5feb\u901f\u6062\u590d\u3002 3.2 \u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u5305 \u5728SSH\u4e2d\u8fde\u63a5\u5230\u8def\u7531\u5668\u540e\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u5b89\u88c5\u4f9d\u8d56\uff1a bash opkg update opkg install curl wget 3.3 \u4e0b\u8f7dXray \u63a5\u4e0b\u6765\uff0c\u9700\u8981\u4e0b\u8f7dXray\u7684\u6700\u65b0\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a bash cd \/tmp wget https:\/\/github.com\/XTLS\/Xray-core\/releases\/latest\/download\/Xray-linux-arm64.zip 3.4 \u89e3\u538b\u5e76\u5b89\u88c5Xray \u89e3\u538b\u4e0b\u8f7d\u7684\u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u79fb\u52a8\u5230\u5408\u9002\u7684\u76ee\u5f55\uff1a bash unzip Xray-linux-arm64.zip -d \/usr\/local\/bin\/ chmod +x \/usr\/local\/bin\/xray 3.5 \u914d\u7f6eXray [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-54070","post","type-post","status-publish","format-standard","hentry","category-vpn"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/54070","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=54070"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/54070\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=54070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=54070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=54070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}