How to change a network MAC address in a VM

BrettR

Member
Dec 8, 2017
17
0
6
64
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!