LoginSignup
7
8

More than 5 years have passed since last update.

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

Posted at

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

7
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8