VMware change Management Network mac address

By | 06/03/2015

There are situations when you need to manually change the mac address of the Management Network on a VMware ESXi host. For example, if you move the hard drives from an ESXi host into another similar server, but with a better hardware configuration, for a quick hardware upgrade, and the reinstall ESXi on the old server, both servers will have the same mac address on the Management Network and they will both have network connectivity problems.

The reason is that the mac address of the management network is saved in a configuration file, and it is the mac address of the network interface card on which the Management Network is configured after install.

After making a server swap as described before, the mac address of the management network should be changed, to correspond to the mac address of the new network interface card, in order to avoid problems. I tried to find a solution to that, but it seems there is not a clear one.

One possible solution is to run the following command:

esxcfg-advcfg -s 1 /Net/FollowHardwareMac

and reboot the server. But I read that for someone who tried this the problem persisted.

Another solution, a better one, seems to be to delete the Management Network and recreate it.

esxcfg-vmknic -d "Management Network"
esxcfg-vmknic -a -i x.y.z.t -n 255.x1.x2.0 "Management Network"

But if you work remotely, this is not a good idea.

My solution was the safest one if you work remotely, I assume. And I did it already 3 or 4 times, every time with success.

First, connect with ssh to the ESXi host and find out the mac addresses of the network interface cards:

~ # esxcfg-nics -l
Name    PCI           Driver      Link Speed     Duplex MAC Address       MTU    Description
vmnic0  0000:03:00.00 tg3         Up   1000Mbps  Full   ac:16:2d:xx:46:3c 1500   Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet
vmnic1  0000:03:00.01 tg3         Up   1000Mbps  Full   ac:16:2d:xx:46:3d 1500   Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet
vmnic2  0000:03:00.02 tg3         Up   1000Mbps  Full   ac:16:2d:xx:46:3e 9000   Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet
vmnic3  0000:03:00.03 tg3         Up   1000Mbps  Full   ac:16:2d:xx:46:3f 9000   Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet

The one that interests me is the first one, because the Management Network is configured on this one.

ac:16:2d:xx:46:3c

Second, find out what is the mac address configured on the Management Network:

~ # esxcfg-vmknic -l | grep Management
vmk0 Management Network IPv4 10.x.y.z 255.255.255.0 10.x.y.255 ac:16:2d:76:46:3c 1500 65535 true STATIC

So, d8:9d:67:xx:64:05. But we want to change it to ac:16:2d:xx:46:3c. 

I searched the /etc folder recursively and I discovered that the mac address of the Management Network is configured in the file /etc/vmware/esx.conf

/etc/vmware # grep "d8:9d:67:xx:64:05" esx.conf
/net/vmkernelnic/child[0000]/mac = "d8:9d:67:xx:64:05"
/net/pnic/child[0000]/mac = "d8:9d:67:xx:64:05"

All I had to do is change it with the correct one:
/etc/vmware # sed -i 's/d8:9d:67:xx:64:05/ac:16:2d:xx:46:3c/g' esx.conf

and then reboot the ESXi host.

Just to be sure, you can check that the replacement command worked:

/etc/vmware # grep "d8:9d:67:xx:64:05" esx.conf
/etc/vmware # grep "ac:16:2d:xx:46:3c" esx.conf
/net/vmkernelnic/child[0000]/mac = "ac:16:2d:xx:46:3c"
/net/pnic/child[0000]/mac = "ac:16:2d:xx:46:3c"

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.