Re: how to assign an ip when assign a NIC or VF to the Virtual Machine?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I use SR-IOV, the guest may be  always "eth0"   , but when I use the VT-d ,I often got an  ethX with a random X in VM.
AFAIK, udev make the NIC name be stable by the MAC address. So when I haven't assigned a VF or NetworkCard to the VM,
how can I force the name in the guest to 'eth0' ?

best regard,
qinguan


2011/5/8 Richard W.M. Jones <rjones@xxxxxxxxxx>
On Sun, May 08, 2011 at 10:56:54AM +0800, guan qin wrote:
> The second solution you mentioned may be difficult , because when I assign
> the ethX to the VM, the X in the 'ethX' is random (the  'X' in the host may
> be different in the VM),I don't know it before I boot the VM . so maybe I
> couldn't edit the guest correctly before booting VM.

AFAIK the guest should always see "eth0", so this shouldn't be any
problem.  If not, write udev rule(s) in the guest to force the name to
be stable.

> The first solution :
> The network card's MAC address I can know and assign an fixed  IP in
> advance, but for the VFs , before I create the VF by "modprobe
> igb/ixgbe
> max_vfs=num1,num2" ,I couldn't know the MAC address before either,the MAC
> address generated randomly too.
> So maybe I should edit the DHCP server configure file after creating the
> VFs.

It seems that for SR-IOV, MAC addresses are assigned to VFs randomly
by the kernel.  It should be possible to read out the VF using (eg)
libvirt before the VM has booted (if not, it would be a bug).  I think
you can also assign fixed MAC addresses to VFs in advance if that
would be simpler.  However I've not really used SR-IOV in anger so
this may be wrong.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]