NIC追加時の設定
Ubuntu でNICを追加したときの設定についてメモ。
NIC を追加して起動。
設定一覧を表示してみます。
root@ubuntu:~# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:76:1a:04 brd ff:ff:ff:ff:ff:ff inet 192.168.1.6/24 brd 192.168.1.255 scope global eth0 valid_lft forever preferred_lft forever inet6 2408:211:a84:2b00:a00:27ff:fe76:1a04/64 scope global mngtmpaddr dynamic valid_lft 14109sec preferred_lft 12309sec inet6 fe80::a00:27ff:fe76:1a04/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 08:00:27:6f:2a:e5 brd ff:ff:ff:ff:ff:ff 4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 56:84:7a:fe:97:99 brd ff:ff:ff:ff:ff:ff inet 172.17.42.1/16 scope global docker0 valid_lft forever preferred_lft forever
eth1 の NICが IPアドレスが振られていません。
これを設定します。
設定ファイルは /etc/network/interfaces にあります
root@ubuntu:~# vi /etc/network/interfaces auto eth1 iface eth1 inet dhcp
NIC を起動します。
root@ubuntu:~# ifup eth1 Internet Systems Consortium DHCP Client 4.2.4 Copyright 2004-2012 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth1/08:00:27:6f:2a:e5 Sending on LPF/eth1/08:00:27:6f:2a:e5 Sending on Socket/fallback DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 3 (xid=0x6a8cc74e) DHCPREQUEST of 192.168.56.101 on eth1 to 255.255.255.255 port 67 (xid=0x6a8cc74e) DHCPOFFER of 192.168.56.101 from 192.168.56.100 DHCPACK of 192.168.56.101 from 192.168.56.100 bound to 192.168.56.101 -- renewal in 549 seconds. ※確認 root@ubuntu:~# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:76:1a:04 brd ff:ff:ff:ff:ff:ff inet 192.168.1.6/24 brd 192.168.1.255 scope global eth0 valid_lft forever preferred_lft forever inet6 2408:211:a84:2b00:a00:27ff:fe76:1a04/64 scope global mngtmpaddr dynamic valid_lft 13676sec preferred_lft 11876sec inet6 fe80::a00:27ff:fe76:1a04/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:6f:2a:e5 brd ff:ff:ff:ff:ff:ff inet 192.168.56.101/24 brd 192.168.56.255 scope global eth1 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe6f:2ae5/64 scope link valid_lft forever preferred_lft forever 4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 56:84:7a:fe:97:99 brd ff:ff:ff:ff:ff:ff inet 172.17.42.1/16 scope global docker0 valid_lft forever preferred_lft forever
eth1 に IPアドレスが割当たりました。
moremagic
2015-06-22