Japanese notation
はじめに
初心者対応構成
- スクリプトでの自動設定
-
UCI (ttyd)、Webコンソール (LuCi)、ファイラー (SFTP)にて比較作業がおススメ
デバイス
OpenWrt
インストール
ファームウェア
イメージのダウンロード > FACTORY をダウンロード
インストールされたパッケージ、初回起動時のスクリプトのカスタマイズ
インストールされたパッケージ
リリースビルド
base-files ca-bundle dnsmasq dropbear firewall4 fstools kmod-gpio-button-hotplug kmod-leds-gpio kmod-nft-offload kmod-rt2800-soc libc libgcc libustream-mbedtls logd mtd netifd nftables odhcp6c odhcpd-ipv6only opkg ppp ppp-mod-pppoe procd-ujail swconfig uci uclient-fetch urandom-seed urngd wpad-basic-mbedtls kmod-usb2 kmod-usb-ohci luci
"snapshot" ビルド
apk-mbedtls base-files ca-bundle dnsmasq dropbear firewall4 fstools kmod-gpio-button-hotplug kmod-leds-gpio kmod-nft-offload kmod-rt2800-soc libc libgcc libustream-mbedtls logd mtd netifd nftables odhcp6c odhcpd-ipv6only ppp ppp-mod-pppoe procd-ujail swconfig uci uclient-fetch urandom-seed urngd wpad-basic-mbedtls kmod-usb2 kmod-usb-ohci luci
初回起動時に実行されるスクリプト (uci-defaults)
管理画面
初期設定ツール
デバイスアクセス
デバイスアクセス(UCI)
パワーシェルでアクセス
PowerShellの開始
- キー入力:
Win
+x
>a
>はい
UCI(SSH)アクセス
powershell:初期設定用
ssh -o StrictHostKeyChecking=no -oHostKeyAlgorithms=+ssh-rsa root@192.168.1.1
- root@192.168.1.1's password:
初期値:パスワード無し
SSHログイン出来ない場合
-
%USERPROFILE%\.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
LuCi
ブラウザーでアクセス
-
openwrt.lan or (192.168.1.1)
- ユーザー名:
root
- パスワード:
パスワード
- ユーザー名:
初期設定
パスワード
初期値から変更
passwd
Changing password for root
New password:
passwd:入力モード
任意のパスワード
Retype password:
passwd:入力モード
再入力
passwd: password for root changed by root
exit
タイムゾーン
タイムゾーンを変更
#!/bin/sh
TIMEZONE='JST-9'
ZONENAME='Asia/Tokyo'
uci set system.@system[0].timezone=${TIMEZONE}
uci set system.@system[0].zonename=${ZONENAME}
uci commit system
/etc/init.d/sysntpd restart
NTP
NTPサーバーを変更
#!/bin/sh
POOL='jp'
uci delete system.ntp.server
uci add_list system.ntp.server=0.${POOL}.pool.ntp.org
uci add_list system.ntp.server=1.${POOL}.ppl.ntp.org
uci add_list system.ntp.server=2.${POOL}.pool.ntp.org
uci add_list system.ntp.server=3.${POOL}.pool.ntp.org
uci commit system
/etc/init.d/sysntpd restart
NTPサーバーを有効
#!/bin/sh
uci set system.ntp.enable_server='1' # NTPサーバー有効
uci set system.ntp.use_dhcp='0'
uci set system.ntp.interface='lan'
uci commit system
/etc/init.d/sysntpd restart
SSH
WANからのアクセスを遮断
uci set dropbear.@dropbear[0].Interface='lan'
uci commit dropbear
パッケージ
母国語サポート
LuCiの言語パッケージをインストール
- 対応言語検索
#! /bin/sh
opkg update
opkg list luci-i18n-base\*
- 設定
#! /bin/sh
I18N='ja'
opkg update
opkg install luci-i18n-base-${I18N}
opkg install luci-i18n-firewall-${I18N}
UCI(TTYD)
ブラウザーでUCIにアクセス
#! /bin/sh
I18N='ja'
opkg update
opkg install luci-i18n-ttyd-${I18N}
uci set ttyd.@ttyd[0].ipv6='1'
uci set ttyd.@ttyd[0].command='/bin/login -f root' #自動ログイン
uci commit ttyd
/etc/init.d/rpcd restart
ファイラー(SFTP)
WinSCPでファイルにアクセス
#! /bin/sh
opkg update
opkg install openssh-sftp-server
クライアント設定(Windows)
- 手動インストール
- ダウンロード:WinSCP
- 自動インストール
- キー入力:
Win
+x
>a
>はい
- 最新版ソフトウェアのインストール
- キー入力:
powershell:クライアントPC
$psVersion = $PSVersionTable.PSVersion.Major
$LINKS = Invoke-WebRequest "https://winscp.net/eng/download.php"
$LINKS_VERSION = $LINKS.Links | Where-Object {$_.href -like "*WinSCP-*-Setup.exe*"} | Select-Object -ExpandProperty href
$VERSION = ($LINKS_VERSION -split '/')[-2] -replace "WinSCP-([0-9]+\.[0-9]+\.[0-9]+).*", '$1'
Write-Host "Version to install: $VERSION"
$downloadUrl = "https://jaist.dl.sourceforge.net/project/winscp/WinSCP/$VERSION/WinSCP-$VERSION-Setup.exe?viasf=1"
Write-Host "Downloading from: $downloadUrl"
$ONAMAE = (whoami).Split('\')[1]
$destinationPath = "C:\Users\$ONAMAE\Downloads\WinSCP-$VERSION-Setup.exe"
Invoke-WebRequest -Uri $downloadUrl -OutFile $destinationPath
Write-Host "Installing WinSCP..."
Start-Process -FilePath $destinationPath -ArgumentList "/VERYSILENT /NORESTART" -Wait
Invoke-Expression "C:\Users\$ONAMAE\AppData\Local\Programs\WinSCP\WinSCP.exe"
-
警告
>強制的に貼り付け
-
WinSCP設定
- セッション
- ホスト名:
192.168.1.1
- ユーザー名:
root
- パスワード:
設定したパスワード
-
ログイン
をクリック
- ホスト名:
- セッション
CPU負荷分散
インストール
#! /bin/sh
opkg update
opkg install irqbalance
uci set irqbalance.irqbalance=irqbalance
uci set irqbalance.irqbalance.enabled='1'
uci commit irqbalance
/etc/init.d/irqbalance start
ネットワーク統計インターフェイス
インストール
#! /bin/sh
I18N='ja'
opkg update
opkg install luci-i18n-statistics-${I18N}
/etc/init.d/collectd enable
/etc/init.d/rpcd restart
- プラグイン検索
#! /bin/sh
opkg update
opkg list collectd-mod\*
追加テーマ
インストール
#! /bin/sh
opkg update
opkg install luci-theme-openwrt
opkg install luci-theme-material
トラブル
初期化
ファクトリーリセット(初期化)
リセット
# 要注意
firstboot && reboot now
This will erase all settings and remove any installed packages. Are you sure? [N/y]
初期化:入力モード
y
デバイスリセットボタン
デバイスのリセットボタンを10秒(LEDが点滅するまで)押し続ける
http://10.10.10.254 でブラウザを開く
- factory をアップロード
- 数分待つ
あとがき
個人的にとても気に入りました!
長さはラズパイZEROと同等です
小さくて、Wi-FiとRJ45 があり、しかもUSBとSDカードスロットまである
フラッシュ8MB、メモリー64MBあるから、24.10が入る👍
リセットボタンがあるのが何気に助かる