これまでRaspberry Pi 3B+でSoftetherを運用してきたが、Raspberry Pi 4Bを購入したので新しく環境を構築する流れをまとめた。
Raspbianのバージョンなどは以下の通り。
pi@raspberrypi:~ $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye
pi@raspberrypi:~ $ uname -a Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
最初にネットワークブリッジの設定をしていきます。
<設定前の状態>
pi@raspberrypi:~ $ ifconfig -a eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.7.26 netmask 255.255.255.0 broadcast 192.168.7.255 inet6 fe80::****:****:eb9b:2e69 prefixlen 64 scopeid 0x20<link> inet6 2400:4050:****:****:ac61:b6da:2cfe:8f7 prefixlen 64 scopeid 0x0<global> ether dc:a6:**:70:13:** txqueuelen 1000 (Ethernet) RX packets 91258 bytes 24276888 (23.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 42910 bytes 2705329 (2.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlan0: flags=4098<BROADCAST,MULTICAST> mtu 1500 ether dc:a6:**:70:13:** txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
bridge-utilsのインストール
pi@raspberrypi:~ $ sudo apt install bridge-utils Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: bridge-utils 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 37.6 kB of archives. After this operation, 116 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian bullseye/main arm64 bridge-utils arm64 1.7-1 [37.6 kB] Fetched 37.6 kB in 0s (95.9 kB/s) Selecting previously unselected package bridge-utils. (Reading database ... 37761 files and directories currently installed.) Preparing to unpack .../bridge-utils_1.7-1_arm64.deb ... Unpacking bridge-utils (1.7-1) ... Setting up bridge-utils (1.7-1) ... Processing triggers for man-db (2.9.4-2) ...
/etc/network/interfacesの編集
pi@raspberrypi:~ $ sudo nano /etc/network/interfaces
#書き込み禁止と出るので再起動してみる。
pi@raspberrypi:~ $ sudo reboot
再度、/etc/network/interfacesの編集
pi@raspberrypi:~ $ sudo nano /etc/network/interfaces
以下を記入
# interfaces(5) file used by ifup(8) and ifdown(8) # Include files from /etc/network/interfaces.d: source /etc/network/interfaces.d/* # Bridge interface auto br0 iface br0 inet dhcp bridge_ports eth0
再起動します。
pi@raspberrypi:~ $ sudo reboot
ブリッジが作られました。
pi@raspberrypi:~ $ ifconfig -a br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.7.27 netmask 255.255.255.0 broadcast 192.168.7.255 inet6 2400:4050:****:****:ac61:b6da:2cfe:8f7 prefixlen 64 scopeid 0x0<global> inet6 fe80::****:****:eb9b:2e69 prefixlen 64 scopeid 0x20<link> ether dc:a6:**:70:13:** txqueuelen 1000 (Ethernet) RX packets 3384 bytes 260004 (253.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 326 bytes 34701 (33.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether dc:a6:**:70:13:** txqueuelen 1000 (Ethernet) RX packets 3387 bytes 308020 (300.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 326 bytes 34701 (33.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 2 bytes 78 (78.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2 bytes 78 (78.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlan0: flags=4098<BROADCAST,MULTICAST> mtu 1500 ether dc:a6:**:70:13:** txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0