DOJEUN's Notepad
 LISTへ 

raspberry pi 無線LANを固定IP Addressにする

家の raspberry pi 2台のip address が変わることがあって ip address を調べるのに面倒だから固定 ip addressにした。


raspberry pi 2 Model B

1. Version 確認

$ lsb_release -a
内容
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

2. dhcpcd.conf ファイル編集

$ sudo nano /etc/dhcpcd.conf
内容
interface wlan0
static ip_address=192.168.1.指定したいIP/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
static domain_search=
noipv6

OS 再起動

raspberry pi 4 Model B 4G

1. Version 確認

$ lsb_release -a
内容
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

2. ネットワーク設定確認

$ nmcli connection show
内容
NAME           UUID                                  TYPE      DEVICE
nameXXXXX xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxx0f083 wifi wlan0 lo f97c1c83-16f5-4f43-a622-6ae0ea62ca99 loopback lo

3. 設定ファイル確認

$ ls -l /etc/NetworkManager/system-connections/
内容
-rw------- 1 root root 354 12月 21 12:05 nameXXXXX.nmconnection

4. nmconnection ファイル編集

$ sudo nano /etc/NetworkManager/system-connections/nameXXXXX.nmconnection
内容
...
[ipv4]
method=manual
address1=192.168.1.指定したいIP/24,192.168.1.1
...

OS 再起動