現在沒有了網絡,估計大家都不知道該怎么消遣娛樂了。 電影、音樂、聊天、視頻 、網絡資訊,缺了網絡,什么都搞不起。不過隨着上網的時間越來越久,就會發現家庭網絡不怎么好用,或者說是家里的路由器不怎么好用。帶寬越來越快,影音下載速度飛快,下載的電影沒地方放,放在電腦上占空間,而且共享給家庭中的其他設備使用也麻煩,電腦不能整天的開機吧;偶爾想科學上網,電腦上配置起來也很麻煩,同樣沒法共享給其他設備;做個家庭智能網關,還需要專門買個設備。路由器全天開機,應該最適合做這些事情呀。
是時候給路由器升級一下,換個系統了。好多廠商,小米、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,點擊進入后會發現如下的列表選擇,
其中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,進入下一級
generic、mikrotik、nand這些是同一平台的特殊硬件支持,generic、nand是兩種不同的flash memory類型,mikrotik是特定於mikrotik路由器硬件。如果在硬件的詳細頁面中,沒有特殊說明flash類型,則選擇generic。
進入后就可以看到具體的固件,基本的后綴有一下幾種:
凡包含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
- 根據上面的內容,找到對應的openwrt固件,下載好*-factory.bin 刷機固件
- 進入tp-link,管理頁面
- 選擇[系統工具]->[軟件升級]->[瀏覽選擇固件]->點擊[升級]
等待1-2分鍾后,刷機OK,就可以開始初始配置了。初始配置請看下一篇[OpenWRT 初始化配置]
D-link 刷OpenWRT
固件升級模式
- 下載好對應的factory固件
- 進入管理頁面,點擊界面上部的 【維護】,然后點擊左側欄的 【固件】 進入升級固件頁面
- 選擇【瀏覽】,選中下載好的對應固件,【升級】
- 等待1-2分鍾,系統重啟。完成升級
- 初始配置 請看下一篇 [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
初始配置 請看下一篇 [OpenWRT 初始化配置]
Netgear刷OpenWrt
- 下載好對應固件
- 進入管理頁面
- [高級]->[管理]->[路由器升級]->選擇固件升級
- 等待1-2分鍾,系統重啟。完成升級
- 初始配置 請看下一篇 [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 初始化配置】