Showing posts with label OpenWRT. Show all posts
Showing posts with label OpenWRT. Show all posts

2017-02-10

WZR-HP-G300NH2 migrate from OpenWRT to DD-WRT

以 wzr-hp-g300nh2-dd-wrt-webupgrade-Multi_r31221.bin 為例:

strip first 28 bytes
dd bs=1 skip-28 if=wzr-hp-g300nh2-dd-wrt-webupgrade-Multi_r31221.bin of=myfirmware.bin
Use open WebGUI to flash myfirmware.bin.

It would take about 20 mins to fully reflash and boot.


OpenWRT webgui 能接受的是以 27 05 19 56 .... 為首的非加密檔案

-----------------------------------------------------------------
TFTP and WebGUi are the best way for flash fw. mtd command is tricky and we should have enough space on the router to contain fw file, enable telnet or sshd, maybe external usb... so better avoid it.
1. If you can still on with openwrt WebGUI:
Use file wzr-hp-g300nh-dd-wrt-webupgrade-MULTI.bin, strip first 28 bytes
dd bs=1 skip=28 if=wzr-hp-g300nh-dd-wrt-webupgrade-MULTI.bin of=myfirmware.bin
Use open WebGUI to flash myfirmware.bin. I've reverted back to dd-wrt by this way. It took 20 mins to fully reflash and boot.
2. TFTP
Use openwrt tftp images. Those files have 32 bytes header.
Actual flash starts at 0x20 offset
0020  27 05 19 56 8C 8E 20 49  4C 70 96 52 00 0D 86 F1  -'..V.. ILp.R....-
0030  80 06 00 00 80 06 00 00  13 72 3C FB 05 05 02 03  -.........r<.....-
0040  4D 49 50 53 20 4F 70 65  6E 57 72 74 20 4C 69 6E  -MIPS OpenWrt Lin-
0050  75 78 2D 32 2E 36 2E 33  32 2E 31 36 00 00 00 00  -ux-2.6.32.16....-
Now I can back and forth any firmware I want, just remember
openwrt WebGUI accepts RAW fw image, that starts with above bolded 5 bytes
openwrt tftp require a 28-bytes header. Spend some time to look at those files and you can modify headers as your needs.
The best way to start new upgrade path is back to factory firmware 1.60 first. Then flash it with buffalo-to-ddwrt followed by dd-wrt-webupgrade.
Hope it helps



WZR-HP-G300NH2 migrate from DD-WRT to OpenWRT

參考文件 : procedure for flashing OpenWRT to wzr-hp-g300nh2

Enable SSH on the router
Login to the router via SSH
Change directory to /tmp and download OpenWrt firmware image file:
cd /tmp
wget http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/openwrt-ar71xx-generic-wzr-hp-g300nh-squashfs-sysupgrade.bin
Overwrite current firmware with the downloaded one:
mtd -r write openwrt-ar71xx-generic-wzr-hp-g300nh-squashfs-sysupgrade.bin linux
After flashing, the router should go down for a reboot and return running OpenWrt.

WZR-HP-G300N2 + OpenWRT

IPV6 : Network>WAN 設定好就啟動了(當然, 必需先向中華電信申請使用 IPV6)

---------------------------------------------------
NNDS :

主要參考文件
1. DDNS client (openwrt ddns howto)
2. openwrt on GITHUB
3. Configuring your dynDNS Client

必須先安裝軟件及準備工作,
opkg update
opkg install wget
opkg install ddns-scripts luci-app-ddns-scripts
opkg install ddns-scripts_no-ip_com (若使用 no-ip.com 的服務)
mkdir -p -m0755 /etc/ssl/certs
wget  --no-check-certificate -O /etc/ssl/certs/ca-certificates.crt http://curl.haxx.se/ca/cacert.pem

1. NO-IP.com : IPV4 ... OK; IPV6 ... 試不出來

2. deSEC.io : IPV4 ... 沒試; IPV6 ... OK
DDNS Service provider [IPV6] ... [-custom-]
update url = https://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&myipv6=[IP]
先在 chrome browser 上, 執行一遍 "https://update.dedyn.io/update?username=[USERNAME]&password=[PASSWORD]&myipv6=[IP]"
並確認 /usr/bin/nslookup [DOMAIN], 正確執行無誤. 否則執行 /usr/lib/ddns/dynamic_dns_updater.sh xxx (xxx=configuration_name) 會有錯誤產生.
Use HTTP Secure : enabled
Path to CA-Certificate : /etc/ssl/certs/ca-certificates.crt

3. mydns.jp : IPV4 ... 沒試; IPV6 ... OK
DDNS Service provider [IPV6] ... mydns.jp
先在 chrome browser 上, 執行一遍 "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV6ADDR=[IP]"
並確認 /usr/bin/nslookup [DOMAIN], 正確執行無誤. 否則執行 /usr/lib/ddns/dynamic_dns_updater.sh xxx (xxx=configuration_name) 會有錯誤產生.
-------------------------------------------------