Howto add hwaddr to nic created with profile?

Is there a way to add hwaddr to nic created with profile?
for example I got profile macvlan:
nictype: macvlan
parent: enp0s31f6
type: nic

and i cant setup hwaddr for eth0

lxc config device set container eth0 hwaddr 00:50:56:01:32:22
Error: The device doesn’t exist


You can do:

lxc config device override <instance> <device> hwaddr 00:50:56:01:32:22

The override command copies the NIC config from the profile into the instance and then modifies the config key(s) you provide.

wow it works! thx
is it normal that now
volatile.eth0.hwaddr is missing from container config
when i set up
eth hwaddr option?


Yes that is normal, what’s happened there is in overriding the profile device, it will have removed the profile device from the instance (clearing any associated volatile keys) and then added a new instance device (with the profile config plus the overridden hwaddr) to the instance which then doesn’t create a volatile key.

thx for clarification
I assume that volatile.eth0.hwaddr automatically will be back when i remove hwaddr from nic eth0?


Yep thats right.

nice thx