Help us understand the problem. What is going on with this article?

Raspberry Pi 2 (Raspbian: jessie) でIPアドレスを固定する

More than 3 years have passed since last update.

概要

Raspbian WheezyでIP固定化する方法は簡単に見つかったが、Jessieでは方法が異なっていたため、設定方法を記録しておくことにします。

設定内容

Wheezyでは /etc/network/interfaces を編集することで固定IP化できましたが、Jessieでは有効になりませんでした。

interfacesファイルをよく見ると、以下のようなコメントが記述されています

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

そこで、dhcpcd.confのmanを見てみる。以下のような記述が

     static value
             Configures a static value.  If you set ip_address then dhcpcd
             will not attempt to obtain a lease and just use the value for the
             address with an infinite lease time.

             Here is an example which configures a static address, routes and
             dns.
                   interface eth0
                   static ip_address=192.168.0.10/24
                   static routers=192.168.0.1
                   static domain_name_servers=192.168.0.1

             Here is an example for PPP which gives the destination a default
             route.  It uses the special destination keyword to insert the
             destination address into the value.
                   interface ppp0
                   static ip_address=
                   destination routers

そっくりそのまま使えそうなので、/etc/dhcpcd.confに以下のように追記して再起動。

etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.15/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

設定したIPアドレスに固定されました。
この例は有線LAN(eth0)を使った例なので、無線の場合は調べてみてください。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした