Ubuntu 18.04 Change Mac Address on QEMU via Netplan

This is a quick note about how to modify mac address for qemu image with ubuntu 18.04 cloud image.

but I have not found a working way only change mac address in system

Add mac parameter to qemu command

in qemu command line, add mac= parameter to netdev option , ex:

-device virtio-net-device,netdev=net2,mac=52:54:00:56:12:34 \

Modify netplan

edit file /etc/netplan/50-cloud-init.yaml, and add section match, ex

     version: 2
             dhcp4: true
                 macaddress: 52:54:00:56:12:34
             set-name: eth0

now, you can shutdown qemu system and restart .

* Notice: if used ubuntu cloud image, please assign mac address before init it.
suppose that cloud image might save mac address some where .

Related posts

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>