Openwrt常用命令

AR系列分区地址

4M flash的分区地址:
分区名        起始地址        结束地址         分区长度 
uboot        0x9f000000         0x9f020000         0x20000 
firmware     0x9f020000         0x9f3e0000         0x3c0000
art          0x9f3f0000         0x9f3e0000         0x10000

8M flash的分区地址:
分区名        起始地址        结束地址         分区长度 
uboot        0x9f000000         0x9f020000         0x20000 
firmware     0x9f020000         0x9f7e0000         0x7c0000
art          0x9f7f0000         0x9f7e0000         0x10000


1.命令行刷系统

固件传至/tmp

1
2
3
4
5
6
7
8
9
cd /tmp
cat /proc/mtd
dev: size erasesize name
mtd0:  00020000  00010000  “u-boot”
mtd1: 000e01c4  00010000  “kernel”
mtd2: 002efe3c  00010000  “rootfs”
mtd3:  00060000  00010000  “rootfs_data”
mtd4:  00010000  00010000  “art”
mtd5: 003d0000  00010000  “firmware”

从上面的命令可以得知,mtd5是 firmare

#使用mtd更新系统

1
mtd -r write factory.bin firmware

#使用sysupgrade更新系统,推荐。

1
sysupgrade factory.bin


2.ttl刷新编程器固件、fw、uboot、art

4M的:

刷编程器固件:

1
2
3
tftp  0x80000000  full.bin
erase  0x9f000000  + 0x400000
cp.b  0x80000000  0x9f000000  0x400000

刷uboot:

1
2
3
tftp  0x80000000  uboot.bin
erase  0x9f000000  + 0x20000
cp.b  0x80000000  0x9f000000  0x20000

刷fw:

1
2
3
tftp  0x80000000  fw.bin
erase  0x9f020000  + 0x3c0000
cp.b  0x80000000  0x9f020000  0x3c0000

刷art:

1
2
3
tftp  0x80000000  art.bin
erase  0x9f3f0000  + 0x10000
cp.b  0x80000000  0x9f3f0000  0x10000


8M的:

刷编程器固件:

1
2
3
tftp  0x80000000  full.bin
erase  0x9f000000  + 0x800000
cp.b  0x80000000  0x9f000000  0x800000

刷uboot:

1
2
3
tftp  0x80000000  uboot.bin
erase  0x9f000000  + 0x20000
cp.b  0x80000000  0x9f000000  0x20000

刷fw:

1
2
3
tftp  0x80000000  fw.bin
erase  0x9f020000  + 0x7c0000
cp.b  0x80000000  0x9f020000  0x7c0000

刷art:

1
2
3
tftp  0x80000000  art.bin
erase  0x9f7f0000  + 0x10000
cp.b  0x80000000  0x9f7f0000  0x10000

3.更新官方固件后命令行安装luci

下列命令适用于ppoe上网方式

1
2
3
4
5
uci  set  network.wan.proto=pppoe
uci  set  network.wan.username= 'secret'
uci  set  network.wan.password= 'secret'
uci commit network
ifup wan

检查连接和dns是否正常

1
ping -c  1  8.8 . 8.8
1
ping -c  1  google.com

如果连接没问题进行下列步骤

1
2
3
4
opkg update
opkg install luci
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start

然后应该就可以打开 http://192.168.1.1/ 登陆了

openwrt命令行模式命令及其工具 需要学会用ssh登录路由器用linux命令查看。 ps 命令查看当前系统运行的进程信息 free 命令查看内存使用和swap挂载情况 ls 查看目录和文件 cd 进入退出目录 vi 查看编辑配置文件 安装命令: #opkg update #opkg install nano uci set network.lan.ipaddr=[lan ip] 使用pppoe设置 Shell代码 uci set network.wan.proto=pppoe //设置wan口类型为pppoe uci set network.wan.username=[上网帐户] uci set network.wan.password=[上网密码] //这两行设置pppoe用户名和密码 如果要挂在上级路由下面,就需要进行下面的设置 Shell代码 uci set network.wan.proto=none //关掉wan uci set network.lan.gateway=[上级路由ip] //网关指向上级路由 uci set network.lan.dns=[上级路由ip] //dns指向上级路由 uci set dhcp.lan.ignore=1 //关掉lan的dhcp 最后对无线网络进行配置 Shell代码 uci set wireless.@wifi-device[0].disabled=0 //打开无线 uci set wireless.@wifi-device[0].txpower=17 //设置功率为17dbm 太高会烧无线模块 uci set wireless.@wifi-device[0].channel=6 //设置无线信道为6 uci set wireless.@wifi-iface[0].mode=ap //设置无线模式为ap uci set wireless.@wifi-iface[0].ssid=[自己设置SSID] //设置无线SSID uci set wireless.@wifi-iface[0].network=lan //无线链接到lan上 uci set wireless.@wifi-iface[0].encryption=psk2 //设置加密为WPA2-PSK uci set wireless.@wifi-iface[0].key=[密码] //设置无线密码 提交应用配置 Shell代码 uci commit //应用 /etc/init.d/network restart //重启网络服务 安装luci管理界面 Shell代码 opkg update // 更新软件列表 opkg list-installed // 查看已安装软件 opkg install luci // 安装LUCI opkg install luci-i18n-chinese // 支持中文 luci-app-firewall - 0.10.0-1 luci-i18n-english - 0.10.0-1 luci-lib-core - 0.10.0-1 luci-lib-ipkg - 0.10.0-1 luci-lib-lmo - 0.10.0-1 luci-lib-nixio - 0.10.0-1 luci-lib-sys - 0.10.0-1 luci-lib-web - 0.10.0-1 luci-mod-admin-core - 0.10.0-1 luci-mod-admin-full - 0.10.0-1 luci-proto-core - 0.10.0-1 luci-proto-ppp - 0.10.0-1 luci-sgi-cgi - 0.10.0-1 luci-theme-base - 0.10.0-1 luci-theme-openwrt - 0.10.0-1 即可完成LUCI的安装。 输入以下命令开启支持web服务的uhttpd,并设置其为自启动: Shell代码 /etc/init.d/uhttpd enable # 开机自启动 /etc/init.d/uhttpd start # 启动uhttpd - Wifidog 你可以尝试执行以下命令安装Wifidog: opkg update # Optional opkg install wifidog --sftp安装 opkg update opkg install vsftpd openssh-sftp-server /etc/init.d/vsftpd enable /etc/init.d/vsftpd start 小米端口转发命令: 通过修改 /etc/config/firewall 这个文件来实现开放自己需要的端口到外网。 config rule 'httpdwan' option src 'wan' option dest_port '8088' option proto 'tcp' option target 'ACCEPT' option name ''\''httpd wan accept tcp port 8088'\''' 保存后,执行 /etc/init.d/firewall restart 重启防火墙。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值