很久以前買的 fon 都只是拿來當一般 AP 用,但前一陣子感覺很不穩,就想說是不是掛了,因為每次摸它都很燙手~後來找問題找了半天,原來問題出在我的小黑 (ThinkPad X60) 上,因為 X60 的無線網卡 Intel 3945 ABG 舊的驅動程式的一個 bug,在於無線網卡的電源管理設定上,只要把電源管理設定為最大值,網路就不會斷斷續續了;而這個 bug 也在後續的新版 driver 中獲得改善。
好了,提外話,不過這也是我把 fon 的韌體刷成 dd-wrt 的起因,所以也不能說毫無關係~呵
接著就來說說改 dd-wrt 韌體的方法吧,基本上網路上有一堆教學,不論是國外的論壇、或是國內的網友自己的心得,多到我實在是不知道怎麼去刷成 dd-wrt。
後來剛好看到一個網站 http:/la-fon.blogspot.com 上面的一篇說明(英文),便照著說明一步一步做下來,耶~竟然成功了呢~
所以我就來紀錄一下我的步驟囉:
- 先下載兩個檔案:
- openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma
- out.hex
- DD-WRT 的 Image 檔案:linux.bin
(可以上 dd-wrt 找看看有沒有更新的版本,連結裡的是我使用的版本)
再來要準備的工具如下:
- PuTTY(或是 PieTTY):用來做 ssh 連線用的工具。
- telnet:用來做 telnet 連線用的工具,可用 windows 內建的 telnet 指令,或是直接用 putty/pietty 也可以。
- tftpd:用來做 tftp 服務的 server
(第一步驟的第三個檔案請跟 tftpd 的目錄放在一塊)
- HFS: 作為檔案傳輸時的 server
(第一步驟的第一、第二個檔案請在 HFS 第一次執行後,在檔案上按右鍵選擇 Add to HFS)
要改機前,得先把 fon 的 ssh port 給打開,我的機器 fon 韌體版本為 0.7.1 r1,所以簡單的以兩個檔案來將 ssh port 打開即可:
- 先將本機電腦的區域網路設定為 ip=169.254.255.2 / mask=255.255.0.0,其餘不用設定。
- 將下列內容複製起來,存為 open-ssh-step1.html
<html>
<head>
</head>
<body>
<center>
<form method=”post” action=”http://169.254.255.1/cgi-bin/webif/connection.sh” enctype=”multipart/form-data”>
<input name=”username” value=”$(/usr/sbin/iptables -I INPUT 1 -p tcp –dport 22 -j ACCEPT)” size=”68″ >
<input type=”submit” name=”submit” value=”Submit” onClick=”{this.form.wifimode.value='”;’ + this.form.wifimode.value +’;”‘}” />
</form>
</body>
</html>
- 再將下列內容複製起來,存成 open-ssh-step2.html
<html>
<head>
</head>
<body>
<center>
<form method=”post” action=”http://169.254.255.1/cgi-bin/webif/connection.sh” enctype=”multipart/form-data”>
<input name=”username” value=”$(/etc/init.d/dropbear)” size=”68″ >
<input type=”submit” name=”submit” value=”Submit” onClick=”{this.form.wifimode.value='”;’ + this.form.wifimode.value +’;”‘}” />
</form>
</body>
</html>
- 在本機電腦上執行 open-ssh-step1.html,按下 submit 按鈕後,會跳出視窗要輸入帳號密碼,請輸入帳號 admin 以及密碼 admin。
- 接著執行 open-ssh-step2.html,也是一樣按下 submit 按鈕後,等到瀏覽器出現 fon 的管理視窗即可。
- 執行 PuTTY/PieTTY,連線到 169.254.255.1,輸入帳號 root 以及密碼 admin。
- 將 /etc/firewall.user 的第 22、23 行註解拿掉
# vi /etc/firewall.user
- 把 fon 的 sshd 設定為開機即啟動
# cd /etc/init.d
# mv dropbear S50dropbear
- 重新設定密碼以及同步一下
# passwd
# sync
- 將 fon 重開後就再也不會自動去升級韌體了。
確認你的電腦的區域網路的 ip=169.254.255.2 / mask=255.255.0.0 / gateway=169.254.255.1(這個不設定也沒關係)
啟動 HFS(預設 port 為 8080),並記得將 openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma 以及 out.hex 加入 HFS 中。
如果你還連在 ssh console 中,那就接著做下列的步驟:
> cd /tmp
> wget http://169.254.255.2:8080/openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma
> mtd -e vmlinux.bin.l7 write openwrt-ar531x-2.4-vmlinux-CAMICIA.lzma vmlinux.bin.l7
> reboot
等待 fon 重新開機後,大約一、兩分鐘,再以 putty/pietty 連入 169.254.255.1 並執行下列指令:
> cd /tmp
> wget http://169.254.255.2:8080/out.hex
> mtd -e “RedBoot config” write out.hex “RedBoot config”
> reboot
等待 fon 重新開機後,將您的電腦區域網路的 ip 改為 192.168.1.166(或是任何一個皆可,不要是 192.168.1.254 就行了),遮罩為 255.255.255.0
啟動 tftpd,並請記得將 linux.bin 與 tftpd 執行程式放在同一個目錄中。
以 telnet command 或是 putty/pietty 連入 192.168.1.254,port=9000。
C:\>telnet 192.168.1.254 9000
按下 Enter 會出現提示符號
RedBoot>
接著請依照黃底粗體黑字來輸入:
RedBoot> ip_address -l 192.168.1.254/24 -h 192.168.1.166
IP: 192.168.1.254/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.166
RedBoot> fis init
About to initialize [format] FLASH image system – continue (y/n)? y
*** Initialize FLASH Image System
… Erase from 0xa87e0000-0xa87f0000: .
… Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> load -r -b 0x80041000 linux.bin
Using default protocol (TFTP)
Raw file loaded 0x80041000-0x806a0fff, assumed entry at 0x80041000
RedBoot> fis create linux
接下來會等個十多分鐘,可能更久。
如果在 load -r -b 0x80041000 linux.bin 之後等了很久,那可能是你忘了啟動 tftpd,如果是這樣,那得退出 telnet 視窗,重新來過。
十幾分鐘後會看到如下畫面:
… Erase from 0xa8030000-0xa8690000: …………………………………………………………………………………………
… Program from 0x80041000-0x806a1000 at 0xa8030000: …………………………………………………………………………………………
… Erase from 0xa87e0000-0xa87f0000: .
… Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> fconfig
Run script at boot: true
Boot script:
.. fis load -l vmlinux.bin.l7
.. exec
Enter script, terminate with empty line
>> fis load -l linux
>> exec
>>
Boot script timeout (1000ms resolution): 10
Use BOOTP for network configuration: false
Gateway IP address:
Local IP address: 192.168.1.254
Local IP address mask: 255.255.255.0
Default server IP address:
Console baud rate: 9600
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Update RedBoot non-volatile configuration – continue (y/n)? y
… Erase from 0xa87e0000-0xa87f0000: .
… Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> reset
完成上述露露等的步驟後,就可以從區域網路透過有線連到 http://169.254.255.1 進入 dd-wrt 介面管理囉,請記得先修改登入的帳號以及密碼唷。
別忘了順便更改一下無線基地台的設定,預設 SSID 名稱是 dd-wrt 並且是沒有設定安全性的。
完成了這一些設定,就可以好好的享受 fon + dd-wrt 所帶來的強大無線基地台的功能囉~~~雖然這有違當初 fon 創辦人的精神 >_<