[SOLVED] Modify hwaddr/MAC of LXC

promoxer

Member
Apr 21, 2023
240
25
23
Code:
# more /etc/pve/lxc/123.conf
...
...
net0: name=eth0,hwaddr=77:88:99:00:AA:BB,type=veth
...
...
# pct set 123 -net0 hwaddr=11:22:33:44:55:66
400 Parameter verification failed.
net0: invalid format - format error
net0.name: property is missing and it is not optional

pct set <vmid> [OPTIONS]
# pct set 123 -net0 name=eth0,hwaddr=11:22:33:44:55:66
Use of uninitialized value in string ne at /usr/share/perl5/PVE/LXC/Config.pm line 1580.
Use of uninitialized value in string ne at /usr/share/perl5/PVE/LXC/Config.pm line 1580.
Use of uninitialized value $bridge in concatenation (.) or string at /usr/share/perl5/PVE/Network.pm line 125.
Use of uninitialized value $bridge in concatenation (.) or string at /usr/share/perl5/PVE/Network.pm line 126.
bridge '' does not exist
# pct set 123 -net0 name=eth0,hwaddr=11:22:33:44:55:66,type=veth
Use of uninitialized value $bridge in concatenation (.) or string at /usr/share/perl5/PVE/Network.pm line 125.
Use of uninitialized value $bridge in concatenation (.) or string at /usr/share/perl5/PVE/Network.pm line 126.
bridge '' does not exist
#

I just want to automate changing the hwaddr and I have no idea what the other values should be. Any ideas?
 
Last edited:
Ok, nevermind, despite the errors `pct set 123 -net0 hwaddr=11:22:33:44:55:66` changes the MAC address.
 
Last edited:
That network device won't function. You may have trouble even starting the LXC.

If you try:
Code:
pct set 123 -net0 name=eth0,bridge=vmbr0,hwaddr=11:22:33:44:55:66,type=veth
You should get no error.

(IDW your bridge setup in PVE, but I used the standard vmbr0. Change according to your setup/requirements).