id: 7398c932d4e8435d8cfce4247f893639
parent_id: 
item_type: 1
item_id: ddae91984e7e4eb282596bb6fc6cec4c
item_updated_time: 1764345565080
title_diff: "[{\"diffs\":[[1,\"命令行 uci设置 OpenWrt 上网参数  OpenWrt智能、自动、透明翻墙路由器教\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":45}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>命令行 uci设置 OpenWrt 上网参数 | OpenWrt智能、自动、透明翻墙路由器教程</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <meta name=\\\"application-data:2525275\\\" content=\\\"6692893/s30/1d20faa3-f71a-4cc3-abb4-530c58016aa3/app.yinxiang.com\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"9774\\\"></a>\\\r\\\n<h1>命令行 uci设置 OpenWrt 上网参数 | OpenWrt智能、自动、透明翻墙路由器教程</h1>\\\r\\\n\\\r\\\n<div>\\\n<span><div>\\\n <div>\\\n  <div>\\\n   <h1>命令行 uci设置 OpenWrt 上网参数</h1>\\\n   <div>\\\n    <div></div>\\\n   </div>\\\n  </div> \\\n  <p>如果路由器可以正常上网的前提，我们可以ssh登陆路由器，直接在路由器的/tmp目录wget下载最新版固件并sysupgrade命令进行固件升级。</p> \\\n  <p>有时候，路由器无法上网，这时候，可以在电脑里下载好固件，再把固件复制到路由器，再sysupgrade升级或设置其他参数。</p> \\\n  <p>只要能进入路由器的安全模式，并ssh登陆路由器，一切都不是问题。</p> \\\n  <h2>Ubuntu下载OpenWrt for TP-LINK wr2543N trunk版固件</h2> \\\n  <pre><code>cd /opt\\\nwget http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-tl-wr2543-v1-squashfs-sysupgrade.bin\\\n</code></pre>\\\n  <h2>scp复制固件到OpenWrt路由器 /tmp目录</h2> \\\n  <pre><code>scp openwrt-ar71xx-generic-tl-wr2543-v1-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/\\\n</code></pre>\\\n  <h2>ssh登陆OpenWrt路由器</h2> \\\n  <pre><code>ssh root@192.168.1.1\\\ncd /tmp\\\n</code></pre>\\\n  <h2>sysupgrade升级固件并取消保留原来配置文件</h2> \\\n  <p>注意，升级后将无法上网，也没有LuCI网页界面可以设置，必须以命令行方式设置好上网参数。</p> \\\n  <p>如果在下面的实验中，命令行方式无法搞定路由器上网，就只能在电脑里下载好带luCI的固件，scp复制固件到路由器升级固件，然后以网页方式设置上网。</p> \\\n  <p>在进行这一步前，确保你熟练掌握以前部分教程。</p> \\\n  <pre><code>root@OpenWrt:/tmp# sysupgrade -n openwrt-ar71xx-generic-tl-wr2543-v1-squashfs-sysupgrade.bin\\\n</code></pre>\\\n  <p>参数 <code>-n</code> 表示升级时不保留原来的配置文件。固件刷好后会自动重启，这时要用前文教程讲过的方法进入OpenWrt安全模式，登陆路由器并重新设置root密码。</p> \\\n  <p>下面假设你已经登陆了路由器并设好了root密码。</p> \\\n  <h2>OpenWrt uci命令行设置拨号上网：</h2> \\\n  <pre><code>root@OpenWrt: uci set network.wan.proto='pppoe'\\\nroot@OpenWrt: uci set network.wan.username='adslname'\\\nroot@OpenWrt: uci set network.wan.password='adslpassword'\\\nroot@OpenWrt: uci set network.wan.peerdns=0\\\n</code></pre>\\\n  <p>adslname替换成你自己的拨号上网用户名，adslpassword替换成你自己的密码。</p> \\\n  <h2>OpenWrt uci命令行设置无线上网：</h2> \\\n  <pre><code><span style=\\\"-evernote-highlighted:true; background-color:#f6ee96\\\">root@OpenWrt: uci set wireless.@wifi-device[0].channel=11 root@OpenWrt: uci set wireless.@wifi-device[0].txpower=17 root@OpenWrt: uci set wireless.@wifi-device[0].disabled=0 root@OpenWrt: uci set wireless.@wifi-device[0].country='CN' root@OpenWrt: uci set wireless.@wifi-iface[0].mode='ap' root@OpenWrt: uci set wireless.@wifi-iface[0].ssid='eastking-wr2543' root@OpenWrt: uci set wireless.@wifi-iface[0].encryption='psk2' root@OpenWrt: uci set wireless.@wifi-iface[0].key='wsjdw,8181'</span>\\\n</code></pre>\\\n  <h3>uci设置说明：</h3> \\\n  <ul><li>channel 信道</li><li>txpower 功率</li><li>disabled 是否启用无线</li><li>ssid 名称，推荐后面以路由器型号结尾，这样调试多个路由器时不会混淆。</li><li>encryption 加密方式</li><li>key 无线密码，如果你照上文的设置不动，好处是忘记密码时可以上 <a href=\\\"http://www.github.com/softwaredownload/openwrt-fanqiang\\\" shape=\\\"rect\\\" target=\\\"_blank\\\">http://www.github.com/softwaredownload/openwrt-fanqiang</a> 来查看。</li></ul> \\\n  <h2>允许远程主机用ssh的方式登陆路由器及设置时区</h2> \\\n  <pre><code>root@OpenWrt: uci set dropbear.@dropbear[0].GatewayPorts='on'\\\nroot@OpenWrt: uci set system.@system[0].zonename='Asia/Shanghai'\\\nroot@OpenWrt: uci set system.@system[0].timezone='CST-8'\\\n</code></pre>\\\n  <h2>ssh登陆OpenWrt相关高级设置（你可能暂时用不到)</h2> \\\n  <pre><code>root@OpenWrt: uci set dropbear.@dropbear[0].Port=22\\\nroot@OpenWrt: uci set dropbear.@dropbear[0].PasswordAuth=off\\\nroot@OpenWrt: uci set dropbear.@dropbear[0].RootPasswordAuth=off\\\n</code></pre>\\\n  <h3>说明（不懂千万别乱设）：</h3> \\\n  <ul><li>Port ssh默认端口就是22,可以改成其他的提高安全性</li><li>PasswordAuth ssh是否启用密钥登陆。如果你改成off，又没有设置好ssh私钥和安装好LuCI，你将无法ssh方式登陆路由器，唯一的办法就是安全恢复模式登陆重新开始设置。</li><li>RootPasswordAuth 是否允许root用密码登陆，如果已经设置好了ssh私钥就可以改成off增加安全性。</li></ul> \\\n  <h2>启用新的网络和无线设置</h2> \\\n  <pre><code><span style=\\\"-evernote-highlighted:true; background-color:#f6ee96\\\">root@OpenWrt: /etc/init.d/dropbear restart root@OpenWrt: /etc/init.d/system restart root@OpenWrt: /etc/init.d/network restart</span>\\\n</code></pre>\\\n  <p>怎么样，有线和无线上网又都回来了吧！</p> \\\n  <p>注意，有的人在网上贴出了他的完整配置文件/etc/config/network 和/etc/config/wireless，　如果你复制他的文件覆盖你的文件，再修改用户名和密码，可能会出问题，因为不同路由器的硬件配置可能不同。</p> \\\n </div>\\\n</div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":4322}]"
metadata_diff: {"new":{"id":"ddae91984e7e4eb282596bb6fc6cec4c","parent_id":"f67288c3a0be4374b5d532b5dcc3aabc","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764348841250,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T21:04:11.523Z
created_time: 2025-11-28T21:04:11.523Z
type_: 13