[libvirt-users] Accessing a MAC address from inside the VM?

Igor Serebryany igor47 at moomers.org
Mon Apr 18 22:34:48 UTC 2011


On Sat, Apr 16, 2011 at 04:21:19PM -0400, David Lane wrote:
> I attach an existing .img file to the host machine and need to change the
> MAC address (since the image was created on another machine).  Is there a
> way from with in the guest to do this or do I have muck with the XML?  And
> if I muck with the XML and change it, how do I pass this information up to
> the guest, or will the guest see it automagically or do I have to write it
> down and then manually transfer it into the guest's ifcfg?

The only way to change what MAC address the interface shows up with is
to tell libvirt about the MAC you want, usually via the XML. There might
be a way to change it after a domain is defined, but I'm not sure.

> Using the GUI, when you change the NIC, the guest generally does not
> see the new MAC and grouses until you change it.

What do you mean by grouses? If you change the MAC in the XML, when your
domain boots it will see an interface with that MAC.

Do you mean that your interfaces don't come up with proper configs? Then
your problem might be udev's persistent net rules. You have config files
which assign IPs to eth0, for instance, but when you change the MAC
address in the XML, eth0 disappears and you instead get an eth1 which
comes up configured.

I solve this problem by removing any persistent network name rules from
udev. You can usually find a config file that controls such things in
/etc/udev/rules.d

--Igor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20110418/4c4c580a/attachment.sig>


More information about the libvirt-users mailing list