LoginSignup
0
0

OpenWrt WXR-5950AX12 WXR-6000AX12 Windowsから導入

Last updated at Posted at 2023-05-17

:warning:Japanese notation

掲示板

バージョン23.05.3対応済み
※未検証(保守のみ)

はじめに

初心者対応構成

  • スクリプトでの自動設定
  • UCIとLuCi及びWinSCPにて比較しながら作業がおススメ

PowerShellSSHアクセス

ssh root@192.168.1.1
ssh root@192.168.1.1のショートカット作成(デスクトップ)
powershell
$DESKTOP = ([Environment]::GetFolderPath("Desktop") + "\192.168.1.1.lnk")
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$DESKTOP")
$Shortcut.TargetPath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
$Shortcut.Arguments = '-windowstyle hidden -ExecutionPolicy RemoteSigned "Start-Process ssh root@192.168.1.1"'
$Shortcut.IconLocation = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe,0"
$Shortcut.WorkingDirectory = "."
$Shortcut.Save()

  • 強制的に貼り付け
  • yes

SSHログイン出来ない場合:exclamation:

known_hostsクリア

  • C:\Users\yourusername\.ssh\known_hosts ※Windows隠しファイル
powershell
Clear-Content .ssh\known_hosts -Force


OpenSSHのインストール
※Windows 10 Fall Creators Update(1709)以降標準搭載

  • 機能の確認
powershell
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

  • 機能のインストール
powershell
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0


ファームウェアについて

デバイスについて

BUFFALO WXR-5950AX12

wxr-5950ax12_320.png

OpenWrt化手順:Flash instruction using initramfs image:

事前準備

  • スクリプト: buffalo
  • ディレクトリ: C:\openwrt

警告 > 強制的に貼り付け

powershell
Set-ExecutionPolicy Unrestricted
New-Item C:\openwrt -ItemType Directory -Force 
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/site-u2023/buffalo/main/wxr5950ax12.ps1" -OutFile "C:\openwrt\wxr5950ax12.ps1"
C:\openwrt\wxr5950ax12.ps1

デバイスをインターネット回線から物理的切断(ONU・HGWからLAN線を外す)

1. Prepare TFTP server with IP address 192.168.11.10

powershell: 192.168.11.10
C:\openwrt\ip\192-168-11-10.ps1

2. Rename OpenWrt initramfs image to "WXR-5950AX12-initramfs.uImage and place it to

powershell
& "C:\openwrt\Serva\Serva64.exe"

Servaが起動

  • I'm a "Community" userを選択
    • 7 Secs待つ
      • 許可

※IPアドレス拾わない場合、ストックファームウェアのデバイスを起動し安定させてから、Servaを起動させる

3. Hold AOSS (WPS) button and power on WXR-5950AX12

  • デバイスの電源を切断
  • デバイス(WXR-5950AX12)のAOSSボタンを押しながら電源に接続
  • 5秒後LEDが赤から白に変わったらAOSSボタンを放す

4. WXR-5950AX12 downloads initramfs image from TFTP server and boots with it automatically

  • 以下2行のログを確認
    • TFTP Inf: Read file <WXR-5950AX12-initramfs.uImage>. Mode octet
    • TFTP Inf: <WXR-5950AX12-initramfs.uImage>: sent blks=8440 blkSz=1468, Total 12388600 bytes in 3s, err recovery=0
  • Servaを閉じる
  • ルーターが自動で再起動
※うまくいかない場合、以下からServaを起動させ再度実行
powershell
& "C:\openwrt\Serva\Serva64.exe"

  • I am"Community" userを選択
  • 左上アイコンをダブルクリック
  • TFTPタブを選択
    • Service Up/Down
      • TFTP Serverにチェック
    • THTP Server IP address
      • 192.168.11.10になっている事を確認
    • THTP Server root directory
      • Browseをクリック
        C:\openwrt\buffalo\WXR-5950AX12-initramfs.uImageを指定
        • Selectをクリック
    • OKをクリック

5. Upload sysupgrade image to WXR-5950AX12 and perform sysupgrade

powershell: 192.168.1.2
C:\openwrt\ip\192-168-1-2.ps1

powershell
scp -r C:\openwrt\buffalo\openwrt-ipq807x-generic-buffalo_wxr-5950ax12-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/openwrt-ipq807x-generic-buffalo_wxr-5950ax12-squashfs-sysupgrade.bin

powershell
ssh root@192.168.1.1

yes

※SSHログイン出来ない場合、以下を削除(隠しファイル)

C:\Users\yourusername\.ssh\known_hosts

powershell
Clear-Content .ssh\known_hosts -Force


SSH
sysupgrade /tmp/openwrt-ipq807x-generic-buffalo_wxr-5950ax12-squashfs-sysupgrade.bin

  • SSHが自動終了
  • LEDが消灯し、ルーターが再起動

絶対に電源は抜かない事

6. Wait ~120 seconds to complete flashing

  • 120秒ほど待つ
  • LEDは以下に動作
  1. 全消灯
  2. 全点灯
  3. 全点滅
  4. 全点灯
  5. 中央白点滅
  6. 中央白点灯OK
  • OpenWrt化完了

デバイスをインターネット回線に物理的接続(ONU・HGWからLAN線に繋ぐ)

クライアントPCをDHCPにする

警告 > 強制的に貼り付け

powershell: DHCP
C:\openwrt\ip\dhcp.ps1
Set-ExecutionPolicy Restricted

MAC addresses:

LAN : 50:C4:DD:xx:xx:28 (0:APPSBLENV, ethaddr (text))
WAN : 50:C4:DD:xx:xx:28 (0:APPSBLENV, ethaddr (text))
2.4 GHz: 50:C4:DD:xx:xx:30 (0:APPSBLENV, wlan0addr (text))
5 GHz : 50:C4:DD:xx:xx:38 (0:APPSBLENV, wlan1addr (text))

新規設定用 オールインワンスクリプト 初心者対応

デバイス更新

アップグレード

ダウンロードサイト

※ダウンロードしたファイル名に合わせリネーム

wget /tmp/openwrt-ipq807x-generic-buffalo_wxr-5950ax12-squashfs-sysupgrade.bin https://downloads.openwrt.org/releases/23.05.3/targets/ipq807x/generic/openwrt-23.05.3-ipq807x-generic-buffalo_wxr-5950ax12-squashfs-sysupgrade.bin
sysupgrade -v /tmp/openwrt-ipq807x-generic-buffalo_wxr-5950ax12-squashfs-sysupgrade.bin

Attended Sysupgrade

opkg update
luci-app-attendedsysupgrade
opkg install auc

※SYSUPGRADEに失敗の場合LEDが点滅点灯のループ(いわゆる文鎮)
 手順を最初からやり直すと復旧出来る(ハードウェア障害は別)

純正ファームウェアリカバリ:Reverting to stock firmware:

事前準備

以下をダウンロード

警告 > 強制的に貼り付け

powershell
Set-ExecutionPolicy Unrestricted
New-Item C:\openwrt -ItemType Directory -Force 
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/site-u2023/buffalo/main/wxr5950ax12-recovery.ps1" -OutFile "C:\openwrt\wxr5950ax12-recovery.ps1"
C:\openwrt\wxr5950ax12-recovery.ps1

デバイスをインターネット回線から物理的切断(ONU・HGWからLAN線を外す)

1. Decrypt official image by buffalo-enc and remove header

公式イメージをbuffalo-encで復号しヘッダーを削除します
(ヘッダー削除はデバイスで作業)

複合

powershell
C:\openwrt\firmware-wintools\firmware-wintools.exe buffalo-enc -i C:\BUFFALO\wxr5950ax12-305\wxr_5950ax12_jp_305 -o C:\BUFFALO\wxr5950ax12-305\wxr_5950ax12_jp_305.dec \ -d -k olaffuB -O 0xc8

複合.png

2. Boot WXR-5950AX12 with OpenWrt initramfs image

OpenWrt initramfs イメージで WXR-5950AX12 を起動します

powershell: 192.168.1.2
C:\openwrt\ip\192-168-1-2.ps1

3. Upload modified stock image to WXR-5950AX12

複合したストックイメージを WXR-5950AX12 にアップロードします

powershell
scp -r C:\BUFFALO\wxr5950ax12-305\wxr_5950ax12_jp_305.dec root@192.168.1.1:/tmp/wxr_5950ax12_jp_305.dec

4.Find partitions "rootfs" and "rootfs_recover"

powershell
ssh root@192.168.1.1

yes

※SSHログイン出来ない場合、以下を削除(隠しファイル)

C:\Users\yourusername\.ssh\known_hosts

powershell
Clear-Content .ssh\known_hosts -Force


ヘッダー削除

example of decryption:

$ buffalo-enc -i wxr_5950ax12_jp_305 -o wxr_5950ax12_jp_305.dec
-d -k olaffuB -O 0xc8

example of removing header (v3.05):

  • before

$ hexdump -n 64 -v -C wxr_5950ax12_jp_305.dec
00000000 57 58 52 2d 35 39 35 30 41 58 31 32 5f 33 2e 30 |WXR-5950AX12_3.0|
00000010 35 5f 31 2e 30 31 5f 4a 50 5f 6a 70 5f 71 63 61 |5_1.01_JP_jp_qca|
00000020 0a 66 69 6c 65 6c 65 6e 3d 34 35 33 35 30 39 31 |.filelen=4535091|
00000030 32 0a 55 42 49 23 01 00 00 00 00 00 00 00 00 00 |2.UBI#..........|
00000040

  • after

$ hexdump -n 64 -v -C wxr_5950ax12_jp_305.ubi
00000000 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 00 |UBI#............|
00000010 00 00 08 00 00 00 10 00 78 cf c4 91 00 00 00 00 |........x.......|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 3d 2a 64 fd |............=*d.|
00000040

SSH
dd if=/tmp/wxr_5950ax12_jp_305.dec bs=1 skip=50 of=/tmp/wxr_5950ax12_jp_305.ubi
hexdump -n 64 -v -C /tmp/wxr_5950ax12_jp_305.ubi

2分弱待つ

wxr_5950ax12_jp_305.ubi.png

example:

root@OpenWrt:/# cat /proc/mtd
dev: size erasesize name
mtd22: 04000000 00020000 "rootfs"
mtd23: 04000000 00020000 "rootfs_recover"
in this case, "rootfs" is mtd22 and "rootfs_recover" is mtd23

パーティション「rootfs」と「rootfs_recover」を見つけます

SSH
cat /proc/mtd

  • 以下、23.05.0
    mtd22: 04000000 00020000 "rootfs"
    mtd23: 04000000 00020000 "rootfs_recover"

5. Format "rootfs"/"rootfs_recover" partition with the uploaded image

example:

ubiformat /dev/mtd22 -f /tmp/wxr_5950ax12_jp_305.ubi
ubiformat /dev/mtd23 -f /tmp/wxr_5950ax12_jp_305.ubi

アップロードしたイメージで「rootfs」/「rootfs_recover」パーティションをフォーマットします

SSH
ubiformat /dev/mtd22 -f /tmp/wxr_5950ax12_jp_305.ubi
ubiformat /dev/mtd23 -f /tmp/wxr_5950ax12_jp_305.ubi

6. Remove "rootfs"/"rootfs_data" volume from user_property partition

example:

. /lib/upgrade/nand.sh
UBI=$(nand_attach_ubi user_property)
ubirmvol /dev/$UBI -N rootfs
ubirmvol /dev/$UBI -N rootfs_data

user_property パーティションから「rootfs」/「rootfs_data」ボリュームを削除します

SSH
. /lib/upgrade/nand.sh
UBI=$(nand_attach_ubi user_property)
ubirmvol /dev/$UBI -N rootfs
ubirmvol /dev/$UBI -N rootfs_data

7. Reboot

再起動

SSH
reboot

絶対に電源は抜かない事

数分待つ

デバイスをインターネット回線に物理的接続(ONU・HGWからLAN線に繋ぐ)

クライアントPCをDHCPにする

※ストックファームウェア管理画面を確認してから実行
警告 > 強制的に貼り付け

powershell: DHCP
C:\openwrt\ip\dhcp.ps1
Set-ExecutionPolicy Restricted

あとがき

  • 現状OpenWrt出来る一般市販デバイスでこれより性能が良いものは無い

  • kmod-qca-nss-dp / Qualcom NSS dataplane ethernet driver
    こんなものが入っている

  • 23.05.0-rc3 AdGuard入れて安定稼働中

  • ストックファームへの復元
    その手順にせよ、Windows用buffalo-encにせよ
    あまりにあっけなく作業出来ました
    感謝です

TFTPがパワーシェルでうまくいかない・・・

IPアドレスは名前が変わると動かないから要検討中 > まあまあか・・・

加工は文字通りバイナリで詠み込むから遅いのなんの、オプションでなんとかなるのか、スキル足らず・・・

ストックファームが自動で取れない、誰か教えて下さい!

ストックファームウェア復旧作業は実時間5、6分程度
よく手順を確認してから作業がおすすめ

参考資料(感謝:relaxed:

ハードウェア表:ファームウェアのダウンロード

Table of Hardware: Ideal for OpenWrt + 802.11ax supported

大破ログ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0