智能路由器-OpenWRT 系列一 (OpenWRT 刷机)

现在没有了网络,估计大家都不知道该怎么消遣娱乐了。 电影、音乐、聊天、视频 、网络资讯,缺了网络,什么都搞不起。不过随着上网的时间越来越久,就会发现家庭网络不怎么好用,或者说是家里的路由器不怎么好用。带宽越来越快,影音下载速度飞快,下载的电影没地方放,放在电脑上占空间,而且共享给家庭中的其他设备使用也麻烦,电脑不能整天的开机吧;偶尔想***,电脑上配置起来也很麻烦,同样没法共享给其他设备;做个家庭智能网关,还需要专门买个设备。路由器全天开机,应该最适合做这些事情呀。

是时候给路由器升级一下,换个系统了。好多厂商,小米、360、极路由都生产了基于OpenWRT系统的智能路由器,功能强大。除了这些路由器,OpenWRT还支持给很多路由器刷机。根据我的日常使用,整理了一系列基本的OpenWRT使用方法,第一篇先介绍如何给路由器刷OpenWRT系统。

OpenWRT是一个高度模块化、高度自动化的嵌入式Linux系统,拥有强大的网络组件和扩展性,常常被用于工控设备、电话、小型机器人、智能家居、路由器以及VOIP设备中。 同时,它还提供了100多个已编译好的软件,而且数量还在不断增加,而 OpenWrt SDK 更简化了开发软件的工序。

OpenWrt 项目由 2004 年 1 月开始, 第一个版本是基于 Linksys 提供的 GPL 源码及 uclibc 中的 buildroot 项目, 这个版本称为 “stable” 版, 在网上至今仍有很多项目使用这个版本, 较为有名 Freifunk-Firmware 和 Sip@Home.

到了2005年初, 一些新的开发人员加入了这项目, 几个月后他们释出了第一个 “experimental” 版本, 这和以前版本不同的是, 这版本差不多完全舍弃了 Linksys 的 GPL 源码, 使用了 buildroot2 作为核心技术, 将 OpenWrt 完全模块化,OpenWrt 使用 Linux 正式发行的核心源码(2.4.30),加上了一些补丁和网络驱动,开发队伍更为OpenWrt添加了许多免费的工具,可以直接把Image写入 Flash (mtd)里面,设定无线功能和VLAN交换功能,这个版本名为“White Russian”,而1.0版本于2005年底公布。

判断路由器是否支持OpenWRT

OpenWRT官方支持的路由器有一份列表,如果在这份表格内,就可以直接下载官方编译好的固件直接刷机。如果不在这个表格内,就需要搜索一下,是否有网友自己编译好的固件,或者编译步骤,按照这个编译步骤自己搭建编译环境编译。

OpenWRT 支持的设备列表: http://wiki.openwrt.org/toh/start

可以看到,常见的路由器品牌,如TP-Link、D-Link、Buffalo、Asus、Huawei、Linksys、Mercury、MikroTik、Netgear都有不少支持的版本。点击设备名称可以进入详细的设备介绍,可以看到设备的硬件信息、支持情况等。

固件下载

确定你的路由器可以刷OpenWRT后,就可以进入下载页找到对应的固件。下载页入口 http://downloads.openwrt.org/, 进入这个页面后,可以选择需要的版本,如Chaos Calmer 15.05.1,点击进入后会发现如下的列表选择,

OpenWRT Target System

其中adm5120、ar7、 ar71xx、x86...这些都是OpenWRT所支持的平台类型,每个平台都使用一些通用的功能、相同的Soc(System on a Chip、系统级芯片),一般来说大部分都使用ar71xx。 OpenWRT的平台说明参考:https://dev.openwrt.org/wiki/platforms, SoC说明参考:https://wiki.openwrt.org/doc/hardware/soc, 选择ar71xx,进入下一级

OpenWRT hardware platform

generic、mikrotik、nand这些是同一平台的特殊硬件支持,generic、nand是两种不同的flash memory类型,mikrotik是特定于mikrotik路由器硬件。如果在硬件的详细页面中,没有特殊说明flash类型,则选择generic。

进入后就可以看到具体的固件,基本的后缀有一下几种:

OpenWRT 固件下载

凡包含factory字样的,是在原机界面上直接刷机用的。bin、img根据原厂的不同有所区别,如bin用在TP-Link系列上,img用在网件Netgare上。

包含sysupgrade字样的,是在OpenWRT系统里的界面,更新固件用的。tftp固件是用tftp方式 刷机用的。网件和巴法络都支持tftp方式刷机。
tar格式是直接在界面上传刷机,不需要解压,在刷机的时候它自动在路由里进行解压。

openwrt-*-factory.bin      标准镜像,用于工厂刷机模式,一般使用squashfs的文件
openwrt-*-factory.img      标准镜像,用于工厂刷机模式
openwrt-*-sysupgrade.bin   标准镜像,用于系统升级模式,一般使用squashfs的文件
openwrt-*-sysupgrade.tar
openwrt-*-tftp.bin         标准镜像,用于tftp刷机模式,一般使用squashfs的文件
      

TP-Link 刷OpenWRT

  1. 根据上面的内容,找到对应的openwrt固件,下载好*-factory.bin 刷机固件
  2. 进入tp-link,管理页面
  3. 选择[系统工具]->[软件升级]->[浏览选择固件]->点击[升级]

TP-Link刷OpenWRT

等待1-2分钟后,刷机OK,就可以开始初始配置了。初始配置请看下一篇[OpenWRT 初始化配置]

D-link 刷OpenWRT

固件升级模式

  1. 下载好对应的factory固件
  2. 进入管理页面,点击界面上部的 【维护】,然后点击左侧栏的 【固件】 进入升级固件页面
  3. 选择【浏览】,选中下载好的对应固件,【升级】
  4. 等待1-2分钟,系统重启。完成升级
  5. 初始配置 请看下一篇 [OpenWRT 初始化配置]

固件恢复模式

Phase 1: OS specific quirks

Note: The firmware recovery mode has following quirks:

If you have a Windows machine available you can use Microsoft Internet Explorer 7 (a Windows running on a VM, like VMware, does not work)
* Windows 8: Firefox cannot be used to update firmware (presumably applies to other versions of Windows).
* Windows 8: Use Internet Explorer 10. Press F12. Select Browser Mode: IE8. Leave the compatibility setting at IE5 Quirks.
* Windows 7: try to turn off ipv6
If you are running Linux you can:
* Ideally use C program below, otherwise:
* Set your interface to 100Mbps using sudo ethtool -s eth0 speed 100 autoneg off, install IE7 in Wine and use it to flash.
* Later models (or some hardware combinations) may need sudo ethtool -s eth0 speed 100 duplex half autoneg off (e.g. B2, FW ver 2.05EU).
* Use the following script.
* firmware 2.02EU should still be available on ftp.dlink.de and it doesn't require IE, nor Mac.
* 2.05EUB09_7 can't be downgraded to 2.04 but fortunately can be downgraded to 2.02EU
* I had to disable both avahi, cups and IPv6 to get it working. (B2 FW ver 2.01EU)
If you are running MacOS you can use Google Chrome Opera
FW version 2.05EU seems very difficult to flash, there may be timing issues (that's just a guess). After downgrading to 2.04EU (get it from ftp.dlink.de) it worked the first time, using IE7 on a virtualbox Win XP "guest". YMMV.
Phase 2: General steps

1. Get into the D-Link recovery console with the steps below:
    a. While powering up the router, press and hold the reset button until the power LED starts blinking orange (usually takes around 45 (forty-five) seconds )
    b. Set a static IP on your PC to 192.168.0.100/24
    c. connect to http://192.168.0.1, mind the quirks!
2. Click "Browse" and select your OpenWrt image file (openwrt-ar71xx-dir-825-b1-squashfs-factory.bin, this binary image is available in the Backfire 10.03.1rc1 download directory and above)
3. Click "Update" and let router flash the image (don't worry if it reboots before it reaches 100%). The page should display "Device is Upgrading the Firmware" in blue letters with the current percentage in red (with an incompatible Browser it doesn't). Look at the screenshot at the end of this section.
4. The router's power LED should blink orange during bootup, as soon as it stops flashing, you can connect to it
Tip! Note that default DHCP will allocate on 192.168.1.x, which is different subnet to the address you allocated above. This is why you can't connect until you change your IP address.

D-Link 恢复模式脚本地址 https://wiki.openwrt.org/toh/d-link/dir-825#asimplescripttoflash_dir-825

d-link firmware recovery mode ie7初始配置 请看下一篇 [OpenWRT 初始化配置]

Netgear刷OpenWrt

  1. 下载好对应固件
  2. 进入管理页面
  3. [高级]->[管理]->[路由器升级]->选择固件升级
  4. 等待1-2分钟,系统重启。完成升级
  5. 初始配置 请看下一篇 [OpenWRT 初始化配置]

Netgear 刷openwrt

OpenWRT版本升级

升级已经安装OpenWRT的路由器,就需要用到下载好的 openwrt-*-sysupgrade.bin 或 openwrt-*-sysupgrade.tar文件

如果OpenWRT已经安装LuCI Web管理界面, 则进入系统管理-升级界面,选择sysupgrade.tar文件进行升级

如果未安装LuCI,则需要ssh登陆到路由器,同时把sysupgrade.bin文件上传至路由器,通过命令行升级。

sysupgrade -v openwrt-xxx-sysupgrade.bin 

这些操作,可以在后面的文章中详细介绍

其他

其他路由器的刷OpenWRT的方法基本类似,就不做过多介绍。

OpenWRT刷好后就需要进行初始化配置,配置完成后才可以联网畅游。马上进入下一篇【OpenWRT 初始化配置】

 

 

转载于:https://www.cnblogs.com/wizju/p/6911785.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值