How to change a network MAC address in a VM

BrettR

Member
Dec 8, 2017
17
0
6
65
What is the correct method for changing the network MAC address within a proxmox VM?

For example, if I have a VM with vmid=905, I normally edit the /etc/pve/qemu-server/905.conf configuration
file.. and change the MAC for the appropriate network interface (e.g.

net0: e1000=0E:03:77:CA:07:24,bridge=vmbr0
would become
net0: e1000=0E:03:77:CA:07:25,bridge=vmbr0
)

I've noticed that restarting the VM..does 'not' cause the new MAC to take effect.

Rather, I have to change the 'hostname' within the VM..(and restart the VM) to make it pickup
the new MAC address.

Thus, do I always need to restart a VM..to get it to apply the new MAC address?

Thanks,

Brett
 
Hi,

When do you say VM, do you mean KVM?
If you mean a KVM, then you have to restart (stop and start the KVM process) to get the changed MAC address applied.

A way to change the mac online is to remove the nic and add it.
This only works if you have enabled hotplug for NIC, and your OS support this.
 
  • Like
Reactions: hanoon
Hi,

When do you say VM, do you mean KVM?
If you mean a KVM, then you have to restart (stop and start the KVM process) to get the changed MAC address applied.

A way to change the mac online is to remove the nic and add it.
This only works if you have enabled hotplug for NIC, and your OS support this.
Just for anyone having issue - here are some details the could help link things together - I had a VM with multiple IPs assigned on the interface level within the OS - Alma Linux didn't play nicely with HotPlug so I disabled it on NIC - After reboot - The machine came up with a new mac address and caused a disconnect until arp cache is cleared on the routing gears. hope that helps