Is it possible to configure libvirt's MAC generation?

Erik Skultety eskultet at redhat.com
Mon Jun 15 07:45:52 UTC 2020


On Fri, Jun 12, 2020 at 02:18:13PM -0400, Alvin Starr wrote:
> One solution would be to dump the XML for the domain and then run something
> like sed on it to change what ever you want and then update the domain.
> Of course that will only work if the domain is stopped.

Another one is to use the virt-xml tool to update only the part you need:

virt-xml <domain> --edit --network network=default,mac.address='<new_mac>'

^This would require you to restart the domain for the change to take effect.

virt-xml <domain> --update --remove device --network mac.address='<old_mac>'
virt-xml <domain --update --add-device --network network=default,mac.address='<new_mac>'

^This would not, because it translates to hot-unplug and hot-plug respectively.

Just an alternative to using sed.

Regards,
Erik




More information about the libvirt-users mailing list