Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
8
Help us understand the problem. What is going on with this article?
@usakoyama

Raspbian Stretchで"iface eth0 inet dhcp"って書きたい。

More than 3 years have passed since last update.

Raspbian StretchでNode-redとDALIを動かすときにネットワーク周りでハマったのでメモ。

/etc/network/interfacesにDHCP設定すると、起動時にdhcpcd.serviceエラーになる。

Jessieのときのソース(/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

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static
    address 192.168.0.0
    netmask 255.255.255.0
    broadcast 192.168.0.255

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

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

エラーを解消するには、/etc/network/interfaces.d 以下に拡張子なしでファイルを作れば読み込んでくれるらしい。
なので、/etc/network/interfaces と /etc/network/interfaces.d/hoge に分割(?)する。


# 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

/etc/network/interfaces.d/hoge

auto lo
iface lo inet loopback

# iface eth0 inet manual

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static
    address 192.168.0.0
    netmask 255.255.255.0
    broadcast 192.168.0.255

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

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

eth0が使えなくなってる問題

Stretchでeth0ではなく、個別の名前なってしまった。けど使いたいので、以下修正。

/boot/cmdline.txt の末尾に
net.ifnames=0
をつけて、eth0の認識させる。

8
Help us understand the problem. What is going on with this article?
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
uhuru
株式会社ウフルはインターネットによる革新的なサービスがお客様企業の価値向上につながる事を目指し「テクノロジーと自由な発想で未来を創る」を企業理念に掲げています。エッジとクラウドを “つなぐ” IoTオーケストレーションサービス「enebular®」をベースにIoTやデジタルマーケティングの領域で顧客のビジネスに変革をもたらし続けております。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
8
Help us understand the problem. What is going on with this article?