8
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

Organization

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

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の認識させる。

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
Sign upLogin
8
Help us understand the problem. What are the problem?