VirtualBoxにCentOS6.2をMinimalでインストールしたあとの設定作業を記します。
CentOS6.x Minimalインストール中にネットワークの設定を忘れずに行えば以下のような作業は不要だと思います。
初期状態では、ネットワークカードが有効になっておらず、さらにBOOTPROTOも記述されていなかったので記述した。
/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 HWADDR=08:00:27:22:01:06 NM_CONTROLLED=yes ONBOOT=yes BOOTPROTO=dhcp TYPE=Ethernet
以下2つが修正・追加部分です。
BOOTPROTO=dhcp ONBOOT=yes
その後、ifup eth0でネットワークカードを有効にしました。
[root@centos6 ~]# ifup eth0 Determining IP information for eth0... done.
[root@centos6 ~]# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 08:00:27:22:01:06 inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe22:106/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6477 errors:0 dropped:0 overruns:0 frame:0 TX packets:3736 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:8556739 (8.1 MiB) TX bytes:209978 (205.0 KiB)
2014/7/23追記
CentOS6.5のMinimalインストールをしたところ、eth1のファイルが作成されていました。
よって、ifcfg-eth1の設定変更のみで動作するようになります。
ネットワークカード(ホストオンリーアダプタ)は認識されているのですが、/etc/sysconfig/network-scripts/ifcfg-eth1などが自動生成されていない。
手動で設定ファイルを作成するのが面倒なので、以下のコマンドでネットワーク設定ツールをインストール。 (CentOS6のMinimalインストールではインストールされていませんでした。)
yum -y install system-config-network-tui
[root@centos6 ~]# yum -y install system-config-network-tui Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile <snip> Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: system-config-network-tui noarch 1.6.0.el6.2-1.el6 base 1.2 M Installing for dependencies: crda x86_64 1.1.1_2010.11.22-1.el6 base 23 k dbus-python x86_64 0.83.0-6.1.el6 base 204 k iw x86_64 0.9.17-4.el6 base 35 k libnl x86_64 1.1-14.el6 base 121 k pciutils x86_64 3.1.4-11.el6 base 83 k python-ethtool x86_64 0.6-1.el6 base 28 k python-iwlib x86_64 0.1-1.2.el6 base 14 k usermode x86_64 1.102-3.el6 base 187 k wireless-tools x86_64 1:29-5.1.1.el6 base 94 k Transaction Summary ================================================================================ Install 10 Package(s) Total download size: 2.0 M Installed size: 7.2 M Downloading Packages: -------------------------------------------------------------------------------- Total 395 kB/s | 2.0 MB 00:05 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : libnl-1.1-14.el6.x86_64 1/10 Installing : python-ethtool-0.6-1.el6.x86_64 2/10 Installing : iw-0.9.17-4.el6.x86_64 3/10 Installing : crda-1.1.1_2010.11.22-1.el6.x86_64 4/10 Installing : 1:wireless-tools-29-5.1.1.el6.x86_64 5/10 Installing : python-iwlib-0.1-1.2.el6.x86_64 6/10 Installing : usermode-1.102-3.el6.x86_64 7/10 Installing : pciutils-3.1.4-11.el6.x86_64 8/10 Installing : dbus-python-0.83.0-6.1.el6.x86_64 9/10 Installing : system-config-network-tui-1.6.0.el6.2-1.el6.noarch 10/10 Installed: system-config-network-tui.noarch 0:1.6.0.el6.2-1.el6 Dependency Installed: crda.x86_64 0:1.1.1_2010.11.22-1.el6 dbus-python.x86_64 0:0.83.0-6.1.el6 iw.x86_64 0:0.9.17-4.el6 libnl.x86_64 0:1.1-14.el6 pciutils.x86_64 0:3.1.4-11.el6 python-ethtool.x86_64 0:0.6-1.el6 python-iwlib.x86_64 0:0.1-1.2.el6 usermode.x86_64 0:1.102-3.el6 wireless-tools.x86_64 1:29-5.1.1.el6 Complete!
system-config-network-tui
ifup eth1設定した内容が有効になり、ネットワークデバイスが有効になっていることを確認しました。
[root@centos6 ~]# ifup eth1 [root@centos6 ~]# ifconfig eth1 eth1 Link encap:Ethernet HWaddr 08:00:27:35:39:EE inet addr:192.168.56.6 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe35:39ee/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1094 errors:0 dropped:0 overruns:0 frame:0 TX packets:608 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:118124 (115.3 KiB) TX bytes:90396 (88.2 KiB)
[root@centos6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Please read /usr/share/doc/initscripts-*/sysconfig.txt # for the documentation of these parameters. DEVICE=eth1 BOOTPROTO=none NETMASK=255.255.255.0 TYPE=Ethernet HWADDR=08:00:27:35:39:ee IPADDR=192.168.56.6
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth1catコマンドで追記されているか確認しました。
[root@centos6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Please read /usr/share/doc/initscripts-*/sysconfig.txt # for the documentation of these parameters. DEVICE=eth1 BOOTPROTO=none NETMASK=255.255.255.0 TYPE=Ethernet HWADDR=08:00:27:35:39:ee IPADDR=192.168.56.6 ONBOOT=yes
尚、うまく動作設定ができない場合などは、HWADDR(マックアドレス)などを確認してください。