RaspberryPI(Jessie環境)で固定IPアドレスを設定する

RaspberryPIにJessieを入れたところ、どれだけ/etc/network/interfacesの設定を変更しても効果がなかったので、メモ。

これまでのWheezyだと前述の/etc/network/interfacesを編集すればよかったのですが、Jessieでは同ファイルのコメントに

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

とあり、今回から(今回だけ?)は/etc/dhcpcd.confで設定することになったようです。man dhcpcd.confのstatic項に載っている、固定IPでの設定方法は以下のとおり。

interface eth0
  static ip_address=192.168.0.10/24
  static routers=192.168.0.1
  static domain_name_servers=192.168.0.1

ということで、同様の記述を/etc/dhcpcd.confの末尾に追記してみたところ、無事に指定したアドレスで動くようになりました。

環境

$ uname -a
Linux raspberrypi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux

$ hostnamectl
   Static hostname: ******
         Icon name: computer
           Chassis: n/a
        Machine ID: ********
           Boot ID: ********
  Operating System: Raspbian GNU/Linux 8 (jessie)
            Kernel: Linux 4.1.13+
      Architecture: arm

参考