Skip to content

Instantly share code, notes, and snippets.

@luftreich
Forked from ninehills/wr703n-openwrt.md
Created July 30, 2016 11:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save luftreich/764dc4bc44fa7ad7fda4b73399c87889 to your computer and use it in GitHub Desktop.
WR703N OpenWrt 配置流程

WR703N OpenWrt 配置流程

下载安装

访问WR703N在OpenWrt的Wiki页,然后在Flashing一节中找到下载链接:squashfs-factory.bin,下载后别忘了比对md5[1]

进入路由器管理界面,出厂配置为http://192.168.1.1,用户名和密码均为admin,然后进入固件更新,选择下载的文件,然后更新。

等待一段时间(~~2min),然后重启路由。

P.S. 官方固件不带WebUI,所以需要对Linux系统较为熟悉,否则可以选择国内有人编译的带LuCI和中文支持的版本,Google即可。

初始配置[2]

首先用一根网线将703N的Lan口和你电脑相连,电脑上设置为DHCP模式。然后

telent 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退出telent,然后

ssh root@192.168.1.1

以后就可以通过ssh管理OpenWrt.

网络配置

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'

然后将路由器的Lan/Wan口接到上级网络中,重启路由器。这时便可以通过电脑寻找SSID为 OpenWrt的无线网络,加入后便可以通过:

ssh root@192.168.1.1

来连接路由器。此时703N为无线路由模式,电脑便可以通过703N上网了。

安装软件

然后便可以用大名鼎鼎的opkg包管理系统。主要命令:

# 查看帮助
opkg help
# 更新数据库,必做
opkg update
# 列出已安装的包
opkg list-installed
# 安装LuCI,我就不选择装了,命令行很好
# 参见 http://wiki.openwrt.org/doc/howto/luci.essentials
opkg install luci

各种配置以后补充。暂时先这么用着。另外703N的RAM只有32M,ROM只有4M,所以能做的事情很少。倒是有人换RAM和ROM芯片的,淘宝上RAM和ROM加倍的只卖150元,喜欢OpenWrt的同学可以考虑一下。

TODO

  1. VPN 无痛翻墙
  2. GoAgent 无痛翻墙
  3. 无线中继
  4. 脱机下载
  5. 3G无线网卡支持

F.A.Q

  1. 无线加密,修改/etc/config/wireless文件,参见[4]。配置wpa加密需要修改config wifi-iface段。

     option ssid OpenWrt
     option encryption psk2
     option key        'secret passphrase'
    
  2. 出现路由端可以ping可以上网,而电脑不能上的问题。电脑端ping结果:

     From 192.168.1.1: icmp_seq=1 Destination Port Unreachable
    

    这时只需要重启firewall服务即可。

     /etc/init.d/firewall restart
    
  3. 进入安全模式

    假如由于各种原因(无线密码,root密码忘了等)无法ssh 路由,则可以进入安全模式,安全模式的进入方法:

    路由器上电,等待指示灯由常亮变为闪烁(大约上电后10s),立刻用尖锐物体按住reset键约5s,此时指示灯快速闪烁,路由器进入failsafe模式。此时将电脑的IP设定为192.168.1.2,子网掩码设定为255.255.255.0,用网线和路由器相连,使用telnet 192.168.1.1便可无需密码登录路由器,其他操作可以直接参见wiki。

参考文献

  1. http://wiki.openwrt.org/toh/tp-link/tl-wr703n
  2. http://wiki.openwrt.org/doc/howto/firstlogin
  3. http://wiki.openwrt.org/doc/uci/network
  4. http://wiki.openwrt.org/doc/uci/wireless
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment