Monday, April 1, 2013

CentOS ready for Hyper-V 2012 NICs

CentOS 6.4 was released on March 13th, and per the release notes it now ships with the Hyper-V components. Now the native network adapters work right from the base install, even on the minimal distribution. All that need be done is enable the adapters after install. To do so, do the following:

  • Log in as root
  • Navigate to /etc/sysconfig/network-scripts
  • Each NIC config is located in this directory. The configs are named ifcfg-ethX where X is a number starting with 0 and incrementing by 1 for each adapter, i.e. ifcfg-eth0, ifcfg-eth1. Edit each by typing "vi ifcfg-eth0"
  • At the least, you will need to edit the file to change ONBOOT=no to ONBOOT=yes by using the following keys:
    • INSERT
    • (make your modifications)
    • ESC
    • :w
    • :q
  • Reboot
If you want to make further modifications such as static IP, etc, then refer to this guide. Feel free to post questions!

Update 12/8/2013: 

When updating/rebuilding my Hyper-V hosts from 2012 to 2012 r2 the MAC addresses seem to have changed. (Perhaps a good reason to set static MAC addresses on these VMs) You can see if your install exhibits this behavior by examining the following:
  •  cat /var/log/dmesg | grep -I "net"
and looking for:

hv_netvsc vmbus_0_13: Device MAC XX:XX:XX
udev: renamed network interface ethX to ethX

To fix it, edit the ifcfg-ethX file as noted above and change the HWADDR entry to match the new MAC, and then remove the /etc/udev/rules.d/70-persistent-net.rules file and reboot.

No comments: