The reason and solution of the problem of Linux virtual Machine network card losing under Hyper-V
The trend of virtualization
The company implemented virtualization, all using Microsoft Windows 2008 R2 Enterprise with Hyper-V to do cluster run Hyper-V virtual machines. This is a good thing, save resources, centralized management, power saving, deployment super fast, the key is to be able to migrate in real time.
We use the Dell Md3000i enclosure as a clustered shared disk, a Gigabit Ethernet networked storage based on iSCSI, a Dell PowerEdge R610 server makes a Windows Cluster, and the switching device is juniper EX22000-48T-4G all Gigabit switches and opens up the giant frame support.
As we all know, Microsoft's Hyper-V for its own Windows virtual machine support is good, but also has a special driver. Even so Linux we have run a lot of virtual machines, mainly because of Windows Hyper-V is cheaper than ESX benefits.
Here's a few awkward things about Linux virtual machines and Hyper-V
1. Network card to choose the old, drive just released
The most fatal thing about opening Linux virtual machines on Hyper-V is the NIC driver, and when we created a new Linux virtual machine, we found that the NIC was not available when we turned the Linux system on. Because Linux systems, whether Rhel or Ubuntu or poop, do not support Hyper-V NIC drivers. This requires us to remove the network Adapter NIC that is mounted to the Linux virtual machine at Hyper-V Manager, and then add a legacy network Adapter, which can simulate a classic, old-fashioned network card. Linux is generally integrated into the driver of this network card, installed the net can be used.
The good news is that Microsoft has just released its August virtual machine driver, which can support Rhel and Ubuntu, with a friend who can Google it online, only hundreds of K, very small.
2. God, My network card?
Do a cluster, then the migration is to avoid, sometimes we need to restart a server to maintain, the need to run the virtual machine on it to migrate to other servers in real time, migration is very smooth, but found that the Linux system migration, Nic can not find, Ifconfig can only see an lo local loop network card, where eth0 run?
Quickly look at the network configuration, sudo vi/etc/network/interfaces, found that the configuration is in, that is why eth0 did not?
Use Ifconfig-a to view all network cards, found Eth0, but more out of the eth1. Brainwave, change the interfaces file.
sudo vi/etc/network/interfaces
Replace eth0 with eth1 and restart network services
sudo/etc/init.d/networking restart
Haha, the network card is good ~ ~
3. Another tragedy.
Later, there is an Ubuntu 9.10 64-bit version of the migration, this trick is not good, because eth1 also did not find, and then manually removed the Ubuntu network configuration file restart, just fine.
sudo rm/etc/udev/rules.d/70-persistent-net.rules
After summing up, Linux is the reason the network card will be lost because of Hyper-V to create a new virtual machine default assigned network card MAC address is dynamic, each host migration will lead to redistribution of new Mac to Ubuntu, and then ya can not find eth0, and sometimes automatically generate a eth1. If you remember your previous MAC address, manually assigning the Mac to the old Mac before migrating on Hyper-V manager can solve the problem, but who the hell will remember the MAC address?
So ah ~ ~ empty Ubuntu's network configuration cache file is the king, or on Hyper-V Manager to assign Linux to the MAC address static.
Installing Linux virtual machines under Hyper-V considerations
1. Create the virtual machine before the dress system, replace the NIC into Legacy network Adapter
2. Network card MAC address do not use dynamic, designated static
3. Microsoft just out of the new Hyper-V Linux driver, hurriedly installed
4. After the loss of network card ifconfig-a see if Eth0 is gone, more out of the eth1, and then change interfaces configuration
5. The ultimate Dafa is to remove the Linux network configuration cache sudo rm/etc/udev/rules.d/70-persistent-net.rules