LoginSignup
5
5

More than 5 years have passed since last update.

Raspberry Pi3 WiFi固定IPの設定

Posted at

設定ファイルの修正

Raspberry Pi3のIP固定化は1つの設定ファイルを修正するだけで変更することができます。ファイルは /etc/network/interfaces

修正方法

sudo vim /etc/network/interfaces

以下の記述をコメントアウトする

iface wlan0 inet manual

次に固定IPの設定情報を追記する。以下のように設定する例です。

設定項目 設定値
固定IP 192.168.1.2
サブネット 255.255.255.0
ゲートウェイ 192.168.1.1
iface wlan0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

ファイルを保存する。
Raspberry Piを再起動する

sudo reboot

ifconfigコマンドで設定が変更されていることを確認する。
以上で固定IP化の設定完了です。

/etc/network/interfacesの最終形は以下の通り

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
#iface wlan0 inet manual
iface wlan0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

注意事項

もし設定にミスると、WiFiでの接続ができなくなりますので、
この作業か必ずRapsberryPi本体でキーボード、ディスプレイを接続して作業することをお勧めします。

5
5
3

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