How To: Networking in CentOS under Hyper-V

Set up a new Hyper-V virtual machine using the wizard, and install CentOS in the Hyper-V virtual machine.
Next, download the Linux Integration Components (LinuxIC) ISO from Microsoft — the link to the current version is at the end of this article. Add the ISO as a “DVD” drive to your VM.
Log into the CentOS VM, and mount the LinuxIC ISO with this command:

mount /dev/cdrom /media

Next, open the /media directory, and then open the directory corresponding to your version of CentOS. For example, if you have CentOS 6.3 installed, open /media/RHEL6. Run the install.sh script.
Create the /etc/sysconfig/network file. This may already exist. If not, enter the following:

vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=COMPUTERNAME.DOMAIN

Create the network script for the adapter. You’ll need to know the MAC address of the network adapter – you can find this in the VM settings section.

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
NM_CONTROLLED=yes
ONBOOT=yes
DHCP_HOSTNAME=$(hostname -s)

Restart the network service to bring up the adapter:

service network restart

NOTE: If you need Internet access before or directly after the installation, you’ll need to add a Legacy Network Adapter – the regular network adapter will not be useable by CentOS until you have installed the Linux Integration Components from Microsoft.
Linux Integration Components download:
http://www.microsoft.com/en-us/download/details.aspx?id=34603

5 Comments

  1. 1. missing info on /etc/sysconfig/network-scripts/ifcfg-eth0 script : where to put MAC address?
    2. Wouldn’t it be easier just to add legacy LAN in the VM properties?

Leave a Reply

Your email address will not be published.


*