[IT] Fedora14 on Hyper-V NIC設定について
こないだ twitter で Fedora14 を Hyper-V で動作させるときの NIC 設定について問い合わせをいただいたり、当サイトへ「Fedora 14 and Hyper-V」検索による来訪が増えているので説明します。
===
【図・Fedora 14 (uname 確認後、ifconfig 確認したところ) 動作状態】
↑これを実現するには、Hyper-V 上での設定でレガシーNICを指定する必要があります。
===
どうやっても NIC がup (起動)しない設定例
ローカルエリア接続が仮想ネットワークになっています。
↓
レガシーネットワークアダプタを指定します。
さて、このレガシーネットワークアダプタですが 、Hyper-V のハードウェア設定から向けるのは勿論ですが、マイクロソフトから提供されている Linux Integration Services v2.1 for Microsoft Hyper-V.EXE ( http://www.microsoft.com/downloads/details.aspx?displaylang=ja&FamilyID=eee39325-898b-4522-9b4c-f4b5b9b64551 )を導入する際にも必要となります。
===
他に設定すべき個所としては、Fedora 側で eth0 を指定したがうまく動作しない時は、 eth1 を設定してはいかがでしょうか?
たとえば、 /etc/sysconfig/network-script/ifcfg-eth0 ではなく、 /etc/sysconfig/network-script/ifcfg-eth1 として、up させる起動スクリプトも eth1 へ向けなおします。
===
※ MSFT LIC に含まれているスクリプトは
BOOTPROTO='dhcp' BROADCAST='' ETHTOOL_OPTIONS='' IPADDR='' MTU='' NAME='Virtual Ethernet Card' NETMASK='' NETWORK='' REMOTE_IPADDR='' STARTMODE='auto' USERCONTROL='no'
このようなテンプレートがあるので流用するのが良さげと思う。
なお、GPL で公開されているので下記に示します。
#!/bin/bash # # Copyright (c) 2009, Microsoft Corporation - All rights reserved. # # This software is available to you under a choice of one of two # licenses. You may choose to be licensed under the terms of the GNU # General Public License (GPL) Version 2, available from the file # LICENSE-GPL in the main directory of this source tree, or the # BSD license (<a href="http://opensource.org/licenses/bsd-license.php">http://opensource.org/licenses/bsd-license.php</a>). # # Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the following # conditions are met: # # - Redistributions of source code must retain the above # copyright notice, this list of conditions and the following # disclaimer. # # - Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials # provided with the distribution. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # Authors: # Haiyang Zhang <<a href="mailto:haiyangz@microsoft.com">haiyangz@microsoft.com</a>> # Hank Janssen <<a href="mailto:hjanssen@microsoft.com">hjanssen@microsoft.com</a>> # usage() { echo "Usage:" echo -e "\t<add> <interface>" exit } # make sure we have 2 args [ -n "$1" ] || usage [ -n "$2" ] || usage ACTION=$1 INTERFACE=$2 INTERFACE_CONFIG_FILE= if [ -f /etc/redhat-release ]; then INTERFACE_CONFIG_DIR=/etc/sysconfig/network-scripts elif [ -f /etc/SuSE-release ]; then INTERFACE_CONFIG_DIR=/etc/sysconfig/network else INTERFACE_CONFIG_DIR=/etc/sysconfig/network-scripts fi # On Sles, let yast autogenerates the ifcfg file. if [ -f /etc/redhat-release ]; then if [[ $ACTION = "add" && $INTERFACE =~ 'seth[0-9]+' ]]; then INTERFACE_CONFIG_FILE=$INTERFACE_CONFIG_DIR/ifcfg-$INTERFACE if [ ! -f $INTERFACE_CONFIG_FILE ]; then echo -n "adding interface configuration file - $INTERFACE_CONFIG_FILE..." echo "DEVICE=$INTERFACE" > $INTERFACE_CONFIG_FILE echo "BOOTPROTO=dhcp" >> $INTERFACE_CONFIG_FILE if [ -f /etc/redhat-release ]; then echo "ONBOOT=yes" >> $INTERFACE_CONFIG_FILE elif [ -f /etc/SuSE-release ]; then echo "STARTMODE=auto" >> $INTERFACE_CONFIG_FILE else echo "ONBOOT=yes" >> $INTERFACE_CONFIG_FILE fi fi echo "done" fi fi
===
検証メモ: Fedora 13 環境から Fedora 14 へアップグレード・マイグレーションを実施してみる、このときインタフェイス ifcfg が変化するかどうか?
以上