{"id":161,"date":"2023-12-13T10:12:23","date_gmt":"2023-12-13T02:12:23","guid":{"rendered":"https:\/\/me.wx.st\/?p=161"},"modified":"2023-12-14T22:06:35","modified_gmt":"2023-12-14T14:06:35","slug":"debian11%e7%bc%96%e8%af%91%e5%8e%9f%e7%89%88openwrt%e8%ae%b0%e5%bd%95","status":"publish","type":"post","link":"https:\/\/me.wx.st\/index.php\/2023\/12\/13\/debian11%e7%bc%96%e8%af%91%e5%8e%9f%e7%89%88openwrt%e8%ae%b0%e5%bd%95\/","title":{"rendered":"debian11\u7f16\u8bd1\u539f\u7248OpenWrt\u8bb0\u5f55"},"content":{"rendered":"\n<p>1\u3001\u9996\u5148\u5b89\u88c5\u7f16\u8bd1\u5fc5\u987b\u8f6f\u4ef6\u5305<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update -y &amp;&amp; apt upgrade -y &amp;&amp; apt install -y sudo\n\nsudo apt install -y build-essential clang flex bison g++ gawk \\\ngcc-multilib g++-multilib gettext git libncurses-dev libssl-dev \\\npython3-distutils rsync unzip zlib1g-dev file wget<\/code><\/pre>\n\n\n\n<p>2.\u521b\u5efa\u4e00\u4e2a\u975eroot\u7528\u6237\uff0c\u4e0b\u9762\u7f16\u8bd1\u90fd\u7528\u8fd9\u4e2a\u65b0\u5efa\u7684\u7528\u6237<\/p>\n\n\n\n<p>\u4f7f\u7528<code>adduser<\/code>\u547d\u4ee4\u521b\u5efa\u65b0\u7528\u6237\u3002\u4f8b\u5982\uff0c\u8981\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>newuser<\/code>\u7684\u7528\u6237\uff0c\u8fd0\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>adduser newuser\n<\/code><\/pre>\n\n\n\n<p>\u5c06\u65b0\u7528\u6237\u6dfb\u52a0\u5230sudo\u7ec4\uff08\u5982\u679c\u4f60\u60f3\u8ba9\u5b83\u5177\u6709sudo\u6743\u9650\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>usermod -aG sudo newuser\n<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u7528\u65b0\u521b\u5efa\u7684\u7528\u6237\u767b\u5f55\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su - newuser\n<\/code><\/pre>\n\n\n\n<p>3.\u62c9\u53d6\u5b98\u65b9\u6e90\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/git.openwrt.org\/openwrt\/openwrt.git\ncd openwrt\ngit pull<\/code><\/pre>\n\n\n\n<p>\u9009\u62e9\u6307\u5b9a\u4ee3\u7801\u5206\u652f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git branch -a\ngit tag  #\u4e00\u76f4\u6309\u56de\u8f66\uff0c\u51fa\u73b0END\uff0c\u6309q\u9000\u51fa\ngit checkout v23.05.2<\/code><\/pre>\n\n\n\n<p>4.\u9996\u6b21\u7f16\u8bd1<\/p>\n\n\n\n<p>\u66f4\u65b0\uff0c\u5b89\u88c5\u8ba2\u9605\u6e90\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/scripts\/feeds update -a &amp;&amp; .\/scripts\/feeds install -a<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u4f60\u60f3\u7f16\u8bd1\u4e0e\u5b98\u65b9\u4e00\u6837\u7684\u56fa\u4ef6\uff0c\u8bf7\u4e0b\u8f7d\u5b98\u65b9config<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/downloads.openwrt.org\/releases\/23.05.2\/targets\/x86\/64\/config.buildinfo -O .config<\/code><\/pre>\n\n\n\n<p>\u8fdb\u5165\u56fe\u5f62\u5316\u914d\u7f6e\u754c\u9762\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make menuconfig<\/code><\/pre>\n\n\n\n<p>\u63d0\u524d\u4e0b\u8f7d\u7f16\u8bd1\u9700\u8981\u7684 dl \u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make download V=s<\/code><\/pre>\n\n\n\n<p>dl \u5e93\u4e0b\u8f7d\u5b8c\u5c31\u53ef\u4ee5\u5f00\u59cb\u7f16\u8bd1\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make -j$(nproc) V=s<\/code><\/pre>\n\n\n\n<p>\u7f16\u8bd1\u597d\u7684\u56fa\u4ef6\u5728&nbsp;<code>bin\/targets<\/code><\/p>\n\n\n\n<p>5.\u4e8c\u6b21\u7f16\u8bd1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd openwrt<\/code><\/pre>\n\n\n\n<p>\u540c\u6b65\u5f53\u524d\u5206\u652f\u6700\u65b0\u6e90\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git pull origin $(git branch -a | grep -E '\\* \\(HEAD detached at .*\\)' | awk '{print substr($5, 1, length($5)-1)}')<\/code><\/pre>\n\n\n\n<p>\u66f4\u65b0\uff0c\u5b89\u88c5\u8ba2\u9605\u6e90\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/scripts\/feeds update -a &amp;&amp; .\/scripts\/feeds install -a<\/code><\/pre>\n\n\n\n<p>\u6e05\u7406\u65e7\u6587\u4ef6\uff08\u5220\u9664&nbsp;<code>\/bin<\/code>&nbsp;\u548c&nbsp;<code>\/build_dir<\/code>&nbsp;\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\uff0c\uff09\u3002\u53ef\u9009<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make clean<\/code><\/pre>\n\n\n\n<p>\u6e05\u9664\u7f16\u8bd1\u914d\u7f6e\u548c\u7f13\u5b58\uff08\u5982\u679c\u4e0d\u6539\u53d8\u914d\u7f6e\uff0c\u8fd9\u6b65\u53ef\u4ee5\u5ffd\u7565\u3002\uff09<code>rm -rf .\/tmp<\/code>&nbsp;\u5220\u9664\u6267\u884c&nbsp;<code>make menuconfig<\/code>&nbsp;\u540e\u4ea7\u751f\u7684\u4e00\u4e9b\u4e34\u65f6\u6587\u4ef6\uff0c\u5305\u62ec\u4e00\u4e9b\u8f6f\u4ef6\u5305\u7684\u68c0\u7d22\u4fe1\u606f\uff0c\u5220\u9664\u540e\u4f1a\u91cd\u65b0\u52a0\u8f7d&nbsp;<code>package<\/code>&nbsp;\u76ee\u5f55\u4e0b\u7684\u8f6f\u4ef6\u5305\uff0c\u82e5\u4e0d\u5220\u9664\u4f1a\u5bfc\u81f4\u4e00\u4e9b\u65b0\u52a0\u5165\u7684\u8f6f\u4ef6\u5305\u4e0d\u663e\u793a\u3002<br><code>.config<\/code>&nbsp;\u82e5\u4e0d\u5220\u9664\uff0c\u53d6\u6d88\u9009\u62e9\u67d0\u4e9b\u7ec4\u4ef6\u5b83\u7684\u4f9d\u8d56\u7ec4\u4ef6\u4e0d\u4f1a\u81ea\u52a8\u53d6\u6d88\uff0c\u6240\u4ee5\u5bf9\u4e8e\u9700\u8981\u8c03\u6574\u7ec4\u4ef6\u7684\u60c5\u51b5\u4e0b\u5efa\u8bae\u5220\u9664\u3002\u53ef\u9009<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm -rf .\/tmp &amp;&amp; rm -rf .config<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u66f4\u6362\u67b6\u6784\u6216\u6e90\u7801\u6709\u91cd\u5927\u66f4\u65b0\uff0c\u4f8b\u5982\u8981\u4ece&nbsp;<code>x86_64<\/code>&nbsp;\u6362\u5230&nbsp;<code>MediaTek Ralink MIPS<\/code>\uff0c\u6216\u8005\u6e90\u7801\u7248\u672c\u66f4\u65b0\u5efa\u8bae\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6df1\u5ea6\u6e05\u7406&nbsp;<code>\/bin<\/code>&nbsp;\u548c&nbsp;<code>\/build_dir<\/code>&nbsp;\u76ee\u5f55\u7684\u4e2d\u7684\u6587\u4ef6\u4ee5\u53ca&nbsp;<code>\/staging_dir<\/code>\u3001<code>\/toolchain<\/code>\u3001<code>\/tmp<\/code>&nbsp;\u548c&nbsp;<code>\/logs<\/code>&nbsp;\u4e2d\u7684\u6587\u4ef6\u3002\uff08\u6e05\u9664\u65e7\u7684\u7f16\u8bd1\u4ea7\u7269\u3001\u4ea4\u53c9\u7f16\u8bd1\u5de5\u5177\u53ca\u5de5\u5177\u94fe\u7b49\u76ee\u5f55\uff09\u53ef\u9009<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make dirclean<\/code><\/pre>\n\n\n\n<p>\u6e05\u9664 OpenWrt \u6e90\u7801\u4ee5\u5916\u7684\u6587\u4ef6\u3002\u53ef\u9009<\/p>\n\n\n\n<p>\u9664\u975e\u662f\u505a\u5f00\u53d1\uff0c\u5e76\u6253\u7b97 push \u5230 GitHub \u8fd9\u6837\u7684\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5426\u5219\u51e0\u4e4e\u7528\u4e0d\u5230\u3002\u6b64\u64cd\u4f5c\u76f8\u5f53\u4e8e&nbsp;<code>make dirclean<\/code>&nbsp;\u5916\u52a0\u5220\u9664&nbsp;<code>\/dl<\/code>\u3001<code>\/feeds<\/code>&nbsp;\u76ee\u5f55\u548c&nbsp;<code>.config<\/code>&nbsp;\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make distclean<\/code><\/pre>\n\n\n\n<p>\u8fd8\u539f OpenWrt \u6e90\u7801\u5230\u521d\u59cb\u72b6\u6001\u3002\u53ef\u9009<\/p>\n\n\n\n<p>\u5982\u679c\u628a\u6e90\u7801\u6539\u574f\u4e86\uff0c\u6216\u8005\u957f\u65f6\u95f4\u6ca1\u6709\u8fdb\u884c\u7f16\u8bd1\u65f6\u4f7f\u7528\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clean -xdf<\/code><\/pre>\n\n\n\n<p>\u8fdb\u5165\u56fe\u5f62\u5316\u914d\u7f6e\u754c\u9762\uff08\u6309\u9700\u6c42\u81ea\u5df1\u914d\u7f6e\uff0c\u4e0d\u6539\u53d8\u914d\u7f6e\uff0c\u8fd9\u6b65\u53ef\u5ffd\u7565\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make menuconfig<\/code><\/pre>\n\n\n\n<p>\u4e0b\u8f7d\u7f16\u8bd1\u9700\u8981\u7684 dl \u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make download V=s<\/code><\/pre>\n\n\n\n<p>\u5f00\u59cb\u7f16\u8bd1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make -j$(nproc) V=s<\/code><\/pre>\n\n\n\n<p>6.\u4fee\u6539\u8f6f\u4ef6\u5305<\/p>\n\n\n\n<p>\u6e90\u4ee3\u7801\u91cc\u7684 feeds.conf.default \u6587\u4ef6\uff0c\u4fdd\u5b58\u7740\u8f6f\u4ef6\u5305\u8ba2\u9605\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>src-git packages https:\/\/git.openwrt.org\/feed\/packages.git\nsrc-git luci https:\/\/git.openwrt.org\/project\/luci.git\nsrc-git routing https:\/\/git.openwrt.org\/feed\/routing.git\nsrc-git telephony https:\/\/git.openwrt.org\/feed\/telephony.git\n<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6e90\u7801\u81ea\u5e26\u7684\u8ba2\u9605\u6ca1\u6709\u4f60\u9700\u8981\u7684\u8f6f\u4ef6\uff0c\u53ef\u4ee5\u6dfb\u52a0\u7b2c\u4e09\u65b9\u8ba2\u9605\u6765\u83b7\u53d6\u3002\u6dfb\u52a0\u5b8c\u8ba2\u9605\uff0c\u5728\u7f16\u8bd1\u7684\u65f6\u5019\u9700\u8981\u66f4\u65b0\u548c\u5b89\u88c5\u8f6f\u4ef6\u5305\uff0c\u547d\u4ee4\u5982\u4e0b\u3002\u6dfb\u52a0\u4e00\u6b21\uff0c\u5c31\u6267\u884c\u4e00\u6b21\u547d\u4ee4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/scripts\/feeds update -a &amp;&amp; .\/scripts\/feeds install -a<\/code><\/pre>\n\n\n\n<p>7.\u66f4\u6539\u67d0\u4e9b\u914d\u7f6e<\/p>\n\n\n\n<p>\u6e90\u4ee3\u7801\u91cc\u7684&nbsp;<code>package\/base-files\/files\/bin\/config_generate<\/code>&nbsp;\u6587\u4ef6\u53ef\u4ee5\u4fee\u6539\u8def\u7531\u5668\u7684\u9ed8\u8ba4\u7684\u7ba1\u7406\u5730\u5740\u3002\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u4fee\u6539\uff08\u5047\u8bbe\u4fee\u6539\u6210 192.168.0.1\uff09\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u6253\u5f00\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sed -i 's\/192.168.1.1\/192.168.0.1\/g' package\/base-files\/files\/bin\/config_generate<\/code><\/pre>\n\n\n\n<p>\u81ea\u5b9a\u4e49\u56fa\u4ef6\u5927\u5c0f<\/p>\n\n\n\n<p>\u6ce8\u610f\uff1a\u7f16\u8bd1\u4e30\u5bcc\u63d2\u4ef6\u65f6\uff0c\u5efa\u8bae\u4fee\u6539\u4e0b\u9762\u4e24\u9879\u9ed8\u8ba4\u5927\u5c0f\uff0c\u7559\u8db3\u63d2\u4ef6\u7a7a\u95f4\u3002\u4ee5 x86\/64 \u4e3a\u4f8b<\/p>\n\n\n\n<p>\u7cfb\u7edf\u5206\u533a\uff0c\u9a71\u52a8\u6216\u63d2\u4ef6\u591a\u7684\u8bdd\u9700\u8981\u9002\u5f53\u6269\u5927\u8fd9\u4e2a\u5206\u533a\u3002<br>Target Images \u2014&gt; (16) Kernel partition size (in MB)<br>\u9ed8\u8ba4\u662f (16) \u5efa\u8bae\u4fee\u6539 (256)<\/p>\n\n\n\n<p>\u6587\u4ef6\u7cfb\u7edf\u5206\u533a\uff0c\u57fa\u672c\u53ef\u4ee5\u7406\u89e3\u4e3a\u5b89\u88c5\u540e\u9ed8\u8ba4\u7684&nbsp;<code>\/overlay<\/code>&nbsp;\u5206\u533a\u5927\u5c0f\u3002<br>Target Images \u2014&gt; (160) Root filesystem partition size (in MB)<br>\u9ed8\u8ba4\u662f (160) \u5efa\u8bae\u4fee\u6539 (512)<\/p>\n\n\n\n<p>\u5355\u72ec\u6dfb\u52a0\u8f6f\u4ef6\u5305<\/p>\n\n\n\n<p>\u4ee5 OpenClash \u4e3a\u4f8b\uff0c\u62c9\u53d6\u6e90\u7801\u5230 package \u76ee\u5f55\u4e4b\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir package\/luci-app-openclash\ncd package\/luci-app-openclash\ngit init\ngit remote add -f origin https:\/\/github.com\/vernesong\/OpenClash.git\ngit config core.sparsecheckout true\necho \"luci-app-openclash\" &gt;&gt; .git\/info\/sparse-checkout\ngit pull --depth 1 origin master\ngit branch --set-upstream-to=origin\/master master\n\n# \u540c\u6b65\u6e90\u7801\ncd package\/luci-app-openclash\/luci-app-openclash\ngit pull<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u6d3b\u52a8\u8fde\u63a5\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#package\/kernel\/linux\/files\/sysctl-nf-conntrack.conf\n\nnet.netfilter.nf_conntrack_acct=1\nnet.netfilter.nf_conntrack_checksum=0\nnet.netfilter.nf_conntrack_max=65535\nnet.netfilter.nf_conntrack_tcp_timeout_established=7440\nnet.netfilter.nf_conntrack_udp_timeout=60\nnet.netfilter.nf_conntrack_udp_timeout_stream=180\nnet.netfilter.nf_conntrack_helper=1\nnet.netfilter.nf_conntrack_buckets=65535\nnet.netfilter.nf_conntrack_expect_max=65535<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539x86\u542f\u52a8\u7b49\u5f85\u65f6\u95f4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#config\/Config-images.in\ndefault \"5\"\u6539\u4e3adefault \"0\"<\/code><\/pre>\n\n\n\n<p>\u89e3\u51b3\u81ea\u884c\u7f16\u8bd1\u7684OpenWrt\u4e0d\u80fd\u5728\u7ebf\u5b89\u88c5\u8f6f\u4ef6\u5305\u7684\u95ee\u9898<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1.\u6253\u5f00https:\/\/downloads.openwrt.org\/releases\/23.05.2\/targets\/x86\/64\/kmods\/\n5.15.137-1-47964456485559d992fe6f536131fc64 #47964456485559d992fe6f536131fc64\u662f\u9700\u8981\u7528\u5230\u7684\u503c<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>touch vermagic #\u5728openwrt\u6e90\u7801\u6839\u76ee\u5f55\u521b\u5efavermagic\u6587\u4ef6\uff0c\u586b\u5165\u4e0a\u4e00\u6b65\u83b7\u53d6\u7684\u503c\n\n2.\u4fee\u6539\/home\/\u4f60\u7684\u7528\u6237\u540d\/openwrt\/include\/kernel-defaults.mk\n\u67e5\u627emkhash\n\u6ce8\u91ca\u6389#grep '=&#91;ym]' $(LINUX_DIR)\/.config.set | LC_ALL=C sort | $(MKHASH) md5 &gt; $(LINUX_DIR)\/.vermagic\n\n\u6362\u884c\u6dfb\u52a0\ncp $(TOPDIR)\/vermagic $(LINUX_DIR)\/.vermagic<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>3.\u4fee\u6539\/home\/\u4f60\u7684\u7528\u6237\u540d\/openwrt\/package\/kernel\/linux\/Makefile\n\u67e5\u627emkhash\n\u6ce8\u91ca\u6389#STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)\/kconfig.pl $(LINUX_DIR)\/.config | $(MKHASH) md5)\n\n\u6362\u884c\u6dfb\u52a0\nSTAMP_BUILT:=$(STAMP_BUILT)_$(shell cat $(LINUX_DIR)\/.vermagic)<\/code><\/pre>\n\n\n\n<p>openwrt \u4fee\u6539\u9ed8\u8ba4\u8bed\u8a00\u4e3a zh_cn<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6587\u4ef6\u5728 feeds\/luci\/modules\/luci-base\/root\/etc\/config\/luci\n\u628a option lang auto \u4fee\u6539\u4e3a option lang zh_cn<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u4e3b\u673a\u540d\u4e3a 2333<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6587\u4ef6\u5728 package\/base-files\/files\/bin\/config_generate\n\u628a set system.@system&#91;-1].hostname='OpenWrt' \u4fee\u6539\u4e3a set system.@system&#91;-1].hostname='2333'<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u65f6\u533a\u4e3a CST-8<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6587\u4ef6\u5728 package\/base-files\/files\/bin\n\u628a set system.@system&#91;-1].timezone='UTC' \u4fee\u6539\u4e3a set system.@system&#91;-1].timezone='CST-8'<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u65f6\u533a\u4e3a\u4e0a\u6d77<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6587\u4ef6\u5728 package\/base-files\/files\/bin\n\u5728 set system.@system&#91;-1].timezone= \u7684\u4e0b\u9762\u6dfb\u52a0 set system.@system&#91;-1].zonename='Asia\/Shanghai'<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539<strong>\u65e0\u7ebf\u540d\u79f0 SSID<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6587\u4ef6\u5728 package\/kernel\/mac80211\/files\/lib\/wifi\/mac80211.sh\n\u628a set wireless.default_radio${devidx}.ssid=OpenWrt \u4fee\u6539\u4e3a set wireless.default_radio${devidx}.ssid=2333<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539wan\u53e3\u4e3apppoe\u62e8\u53f7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package\/base-files\/files\/lib\/functions\/uci-defaults.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ucidef_set_interface_wan() {\n    #dhcp\u6539\u6210pppoe\n    ucidef_set_interface \"wan\" ifname \"$1\" protocol \"${2:-dhcp}\"\n  }<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539lan\u53e3ip\u548cpppoe\u62e8\u53f7\u7528\u6237\u540d\u3001\u5bc6\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package\/base-files\/files\/bin\/config_generate<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code> case \"$protocol\" in\n        static)\n            local ipad\n            case \"$1\" in\n                #\u4fee\u6539lan\u53e3ip\n                lan) ipad=${ipaddr:-\"192.168.1.1\"} ;;\n                *) ipad=${ipaddr:-\"192.168.$((addr_offset++)).1\"} ;;\n            esac\n\n            netm=${netmask:-\"255.255.255.0\"}\n\n            uci -q batch &lt;&lt;-EOF\n                set network.$1.proto='static'\n                set network.$1.ipaddr='$ipad'\n                set network.$1.netmask='$netm'\n            EOF\n            &#91; -e \/proc\/sys\/net\/ipv6 ] &amp;&amp; uci set network.$1.ip6assign='60'\n        ;;\n\n        dhcp)\n            # fixup IPv6 slave interface if parent is a bridge\n            &#91; \"$type\" = \"bridge\" ] &amp;&amp; ifname=\"br-$1\"\n\n            uci set network.$1.proto='dhcp'\n            &#91; -e \/proc\/sys\/net\/ipv6 ] &amp;&amp; {\n                uci -q batch &lt;&lt;-EOF\n                    delete network.${1}6\n                    set network.${1}6='interface'\n                    set network.${1}6.ifname='$ifname'\n                    set network.${1}6.proto='dhcpv6'\n                EOF\n            }\n        ;;\n\n        pppoe)\n            uci -q batch &lt;&lt;-EOF\n                set network.$1.proto='pppoe'\n                #\u62e8\u53f7\u7528\u6237\u540d\n                set network.$1.username='username'\n                #\u62e8\u53f7\u5bc6\u7801\n                set network.$1.password='password'\n            EOF\n            &#91; -e \/proc\/sys\/net\/ipv6 ] &amp;&amp; {\n                uci -q batch &lt;&lt;-EOF\n                    set network.$1.ipv6='1'\n                    delete network.${1}6\n                    set network.${1}6='interface'\n                    set network.${1}6.ifname='@${1}'\n                    set network.${1}6.proto='dhcpv6'\n                EOF\n            }\n        ;;\n    esac<\/code><\/pre>\n\n\n\n<p>\u4fee\u6539\u9ed8\u8ba4eth0\u4e3awan<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package\/base-files\/files\/etc\/board.d\/99-default_network<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ucidef_set_interface_lan 'eth1 eth2 eth3'\n&#91; -d \/sys\/class\/net\/eth1 ] &amp;&amp; ucidef_set_interface_wan 'eth0'<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u9996\u5148\u5b89\u88c5\u7f16\u8bd1\u5fc5\u987b\u8f6f\u4ef6\u5305 2.\u521b\u5efa\u4e00\u4e2a\u975eroot\u7528\u6237\uff0c\u4e0b\u9762\u7f16\u8bd1\u90fd\u7528\u8fd9\u4e2a\u65b0\u5efa\u7684\u7528\u6237 \u4f7f\u7528adduser\u547d\u4ee4\u521b\u5efa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-161","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":3,"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":165,"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/posts\/161\/revisions\/165"}],"wp:attachment":[{"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/me.wx.st\/index.php\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}