记录下Openwrt刷机过程,以供后续需要时查看。
1,给WR703N刷Openwrt系统
因为703N默认是3G模式,所以第一次配置时不要插网线,否则可能导致无法登陆。
1) 到openwrt网站去下载两个固件,地址是:http://downloads.openwrt.org/snapshots/trunk/ar71xx/ 。
第一个文件名:openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
第二个文件名:openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin
2)给路由器接电源,等待初始化完成;
3) 通过无线(WIFI)登陆路由器,未设置时是不需要密码的;
4) 打开IE,登陆路由器,IP是192.168.1.1,用户名和密码是:admin;
5) 进入‘系统工具’->‘软件升级’,选择固件:
并开始升级。
一直等待升级完毕,不要断电。
刷完openwrt后需要继续刷升级包,也就是openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin,因为703N空间有限,这里直接采用命令方式更新。
1) 通过winscp连接路由器,winscp配置如下:
2) 上传固件至路由器,这里直接上传升级文件xxx.bin至路由器/tmp目录下;
3) 升级固件,命令如下:
mtd -r write /tmp/xxx.bin firmware
刷完系统后路由器自动重启。已经刷了openwrt系统的openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin也可以通过这个命令来再次刷新。
这里都是用有线方式升级的,当刷了openwrt后可以直接通过wifi来升级路由器。
2,配置Openwrt系统参数
因为Openwrt的http默认是关闭的,所以直接通过输入192.168.1.1是无法登陆路由器的,但是cmd下面ping192.168.1.1是可以成功的。
以下配置过程摘自:http://ninehills.info/2012/05/07/set-openwrt-in-wr703n.html
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
P.S. 官方固件不带WebUI,所以需要对Linux系统较为熟悉,否则可以选择国内有人编译的带LuCI和中文支持的版本,Google即可。
初始配置[2]
首先用一根网线将703N的Lan口和你电脑相连,电脑上设置为DHCP模式。然后(可直接在windows命令行下输入)
telnet 192.168.1.1
成功后出现OpenWrt的欢迎界面:
BusyBox v1.19.4 (2012-05-05 05:41:33 MST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
然后更改root密码:
passwd root
更改root密码后
dropbear
(SSH 服务)就运行了,输入
exit
退出telnet,然后
ssh [email protected]
以后就可以通过ssh管理OpenWrt.
可使用putty.exe工具来登陆,按照下图配置,并登陆。
网络配置
OpenWrt官方的固件是不带LuCl的,所以初始的网络设定需要在命令行下完成 首先备份相关配置,防止出错:
cp /etc/config ~/ -r
然后用
vi
修改相关配置(不会用vim的同学悲剧了)。 首先修改
/etc/config/wireless
文件,注释掉
# option disabled 1
然后修改
/etc/config/network
文件[3],首先修改
lan
接口配置,注释掉此行:
# option ifname 'eth0'
然后增加
wan
接口,如果你上级网络是DHCP的,则文件的末尾添加:
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
如果你上级网络是静态IP,则在文件的末尾添加:
config interface 'wan'
option ifname 'eth0'
option proto 'static'
option ipaddr '10.22.33.124'
option netmask '255.255.255.0'
option gateway '10.22.33.1'
option dns '202.113.16.10 8.8.8.8'
然后将路由器的Lan/Wan口接到上级网络中,重启路由器。这时便可以通过电脑寻找SSID为
OpenWrt
的无线网络,加入后便可以通过:
ssh [email protected]
来连接路由器。此时703N为无线路由模式,电脑便可以通过703N上网了。
安装软件
然后便可以用大名鼎鼎的opkg包管理系统。主要命令:
# 查看帮助
opkg help
# 更新数据库,必做
opkg update
# 列出已安装的包
opkg list-installed
# 安装LuCI,我就不选择装了,命令行很好
# 参见 http://wiki.openwrt.org/doc/howto/luci.essentials
opkg install luci
F.A.Q
- 无线加密,修改
文件,参见[4]。配置wpa加密需要修改/etc/config/wireless
段。config wifi-iface
option ssid OpenWrt #wifi名称 option encryption psk2 #加密方式 option key 'secret passphrase' #密码
- 出现路由端可以ping可以上网,而电脑不能上的问题。电脑端ping结果:
这时只需要重启From 192.168.1.1: icmp_seq=1 Destination Port Unreachable
服务即可。firewall
/etc/init.d/firewall restart
- dropbear 密钥验证。使用ssh-copy-id是无效的,dropbear只认全局配置[5],所以需要:
ssh-copy-id [email protected] mv /root/.ssh/authorized_keys /etc/dropbear/authorized_keys
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
通过以上步骤应可以上网,但是仍无法通过 http://192.168.1.1登陆路由器,是因为http服务还没打开,还需以下步骤:
1) opkg install luci-i18n-chinese #安装汉化包
2) opkg install firewall #安装防火墙
3) /etc/init.d/uhttpd enable
4) /etc/init.d/uhttpd start
5) /etc/init.d/firewall enable
6) /etc/init.d/firewall start
7) reboot #重启路由器
现在在打开IE,已经可以输入http://192.168.1.1进行登陆了。
由于wr703N空间有限,如果安装了luci后,已经没有空间在安装其他软件。后面将继续记录将系统挂载到U盘,彻底解决系统空间限制问题。
推荐几个好的博客:
http://blog.csdn.net/qinpeng_zbdx/article/details/8570488
http://blog.csdn.net/yufei_email?viewmode=contents