10

I've launched a CentOS install in HyperV and assigned a NIC the same way I've done on an Ubuntu VM, however, the device simply isn't picked up.

Only my loopback is found by ifconfig.

How should I go about trouble shooting this?

jasonwryan
  • 73,126
Incognito
  • 231
  • What does lsmod on the working Ubuntu VM show for a network card driver? Is that module loaded on the CentOS VM? What does ifconfig eth0 up accomplish? – Caleb Jul 26 '11 at 20:21
  • The two OSs have a vast number of modules that aren't shared between them (ie, way over 20). ifconfig eth0 indicates "eth0: error fetching interface information: Device not found" – Incognito Jul 26 '11 at 20:36
  • 2
    Not to be condescending or too pedantic, but are you running ifconfig -a? Another, more compact way to see the network interfaces on a system is with ip a l (assumes iproute2, installed by default in CentOS I believe). – Eli Heady Aug 03 '11 at 03:45
  • 2
    ifconfig -a revealed that I have eth2 –  Feb 24 '12 at 13:19

3 Answers3

8

UPDATE: This has been updated to reflect the changes they made with the LIS v4 that no longer requires running the version-specific installer. Also, if all you need is for Hyper-V to report the info in the "Network" tab, only steps 1-4 are necessary)

I had the same problem; reinstalled the driver. Here is what I did:

  1. Install CentOS
  2. Download "Linux Integration Disk" for Hyper-V from Microsoft (There are multiple versions, the latest one contains the previous distros)
  3. Mount the ISO image file.
    sudo mount /dev/cdrom /media
  4. Run install.sh under the Linux Integration Services CD's LISISO Folder (Where xx is the latest version, or the specific version you need).
    sudo /LISISO/install.sh
  5. Create ifcfg-eth0 file.
    nano /etc/sysconfig/network-scripts/ifcfg-eth0
  6. Insert the following lines:

    DEVICE=eth0
    BOOTPROTO=dhcp
    ONBOOT=yes
    
  7. Save and quit

  8. Edit or create network file
    nano /etc/sysconfig/network
  9. Insert the following lines:

    NETWORKING=yes
    HOSTNAME=server-name.company.lan
    

    Save and quit

  10. Restart and now you can ping out
Taegost
  • 127
Henry Aloni
  • 181
  • 1
  • 4
  • I had this same issue today with a fresh RHEL 7.4 VM, the only steps I had to perform were 5-9, and the only thing I did different is that (I didn't include the HOSTNAME attribute, and I used vi instead of nano – Taegost Mar 05 '18 at 18:23
4

It sounds like drivers for HyperV virtualized NICs are missing from the CentOS kernel version you are using and are present in the Ubuntu version you successfully installed. Microsoft has only recently gotten its virtual device drivers into the mainline kernel. My guess is that you are using a version of CentOS that does not include these drivers.

As far as how to troubleshoot it, you can look for kernel messages related to network hardware. Check the output of dmesg | less and less /var/log/messages. I would look for entries containing "net", "eth". Any kernel logging is going to be from module loading - success or error. If there are no kernel modules for the virtualized NIC, the kernel probably won't have anything to say about the unrecognized hardware.

When creating the VM, you can choose to add a "Legacy Network Adapter" in HyperV (at least the option used to be called that). This will present the NIC to the guest OS as essentially an older device, for which the guest will hopefully have drivers.

Once you have installed CentOS, you can install drivers from Microsoft to utilize the more efficient virtual devices.

Eli Heady
  • 1,234
  • I'm not sure if this solved it for me or if the case was that my VM only had eth0 set to manual mode, and I had to enable dhcp and onboot – jcolebrand Mar 20 '12 at 16:49
1

In my case, I added a new VM to Windows 10 Hyper-V by importing a VHD of CentOS7 Linux. Installation was fine, but networking in CentOS wasn't working at all. To solve the issue, in Hyper-V, I selected the new VM and edited the settings. Under Network Adapter, the Virtual Switch was set to "Not Connected" by default. Changing this to "Default Switch" and saving fixed the issue. This solved errors such as no suitable device found for this connection and unable to find eth0.

Barry Cox
  • 11
  • 1