LoginSignup
7
10

More than 3 years have passed since last update.

OpenWRTをRaspberry PI4に入れる

Posted at

Raspberry PI4 をルータにする

BusyBox v1.31.1 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r12230-5715b21f80
 -----------------------------------------------------

SDカードにイメージを書き込む

$ cd /tmp
$ wget https://downloads.openwrt.org/snapshots/targets/brcm2708/bcm2711/openwrt-brcm2708-bcm2711-rpi-4-ext4-factory.img.gz
$ gunzip openwrt-brcm2708-bcm2711-rpi-4-ext4-factory.img.gz
$ sudo dd if=/tmp/openwrt-brcm2708-bcm2711-rpi-4-ext4-factory.img of=/dev/sdX bs=2M conv=fsync

ネットワークの設定

$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.8.1     0.0.0.0         UG        0 0          0 eth0
192.168.8.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.8.1     0.0.0.0         255.255.255.255 UH        0 0          0 eth0

ネットワークを確認します。

RaspberryPiに電源を入れてログイン

# uci set network.lan.ipaddr=192.168.8.22
# uci set network.lan.gateway=192.168.8.1
# uci set network.lan.dns=192.168.8.1
# uci commit
# service network restart

sshでログインしてパスワード設定

$ ssh root@192.168.8.22
# passwd
Changing password for root
New password: 
Bad password: too weak
Retype password: 
passwd: password for root changed by root

LuCIのインストール

# opkg update
# opkg install luci
# opkg install \
    luci-i18n-base-ja \
    luci-i18n-firewall-ja \
    luci-i18n-opkg-ja
# service uhttpd restart

下は、LuCIの日本語パッケージです。

RaspberryPiのアドレスにブラウザアクセス

OpenWrt01.png

ssh 公開鍵の追加

システム > 管理画面 > SSHキー

OpenWrt02.png

無線ネットワーク設定

ネットワーク > 無線

OpenWrt03.png

無線LANの編集


OpenWrt04.png

デフォルトの値のままだと、Legacyに設定したらうまく行きました。


OpenWrt05.png

端末からの接続ができれば、こんな画面になるはずです。

動作周波数:Nモードしたい

とりあえず3桁MBは欲しいので今後調べます。

付録

マウントインストール

# opkg update
# opkg install block-mount

ユーザー追加イストール

# opkg update
# opkg install shadow-useradd

参考

7
10
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
7
10