DHCPでIPを割り振っているワイヤレスLANを固定IP化します。
予め、 ifconfig コマンドで現在使用しているワイヤレスLANのインターフェイスを確認しておきます。通常であれば「wlan0」にIPアドレスが割り振られて、現在使用中のワイヤレスLANインターフェイスは「wlan0」である事が確認できます。
ラズベリーパイのIPアドレスは /etc/network/interfaces で設定します。
pi@raspberrypi:~$ sudo nano /etc/network/interfaces |
後で変更履歴が分かるように、
iface wlan0 inet manual
の前に”#”を付けてコメントアウトします。
改めて以下の設定を追加します。
iface wlan0 inet static
address 192.168.1.111
netmask 255.255.255.0
gateway 192.168.1.1
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd # Include files from /etc/network/interfaces.d: auto lo iface eth0 inet manual allow-hotplug wlan0 # 追記 allow-hotplug wlan1 |
Ctrl+o で上書保存。Ctrl+x で終了します。
reload して設定を有効にします。
pi@raspberrypi:~$ sudo /etc/init.d/networking reload |
ifconfigコマンドやSSHでログインして設定したIPアドレスが反映されていることを確認します。