Debian 8 のIPアドレスの変更を行う場合の設定例をメモしておく。
設定ファイルの編集
/etc/network/interfacesファイルを編集する。
初期状態(DHCPによりIPアドレスを設定)
source /etc/network/interfaces.d/* auto lo iface lo inet loopback allow-hotplug eth0 iface eth0 inet dhcp
固定IPアドレスの場合
source /etc/network/interfaces.d/* auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.0.11 network 192.168.0.0 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.0.1 dns-nameservers 192.168.0.1
「auto eth0」の場合は、システム起動時にeth0を起動する。
「allow-hotplug eth0」の場合は、カーネルがホットプラグイベントを認識したときに起動する。
ネットワーク再起動
ネットワークを再起動する。
/etc/init.d/networking restart