atomic-penguin's blog

Musings on Linux, Opscode Chef, online gaming, and home cooking.

Mini HOWTO - VMWare MAC Address Change on RHEL

If you move a Virtual Machine to a different cluster in VMware, the MAC address may change. This is a fairly easy fix, if you know where to look.

1. UDEV

Look for a “persistent net” rule in udev.

1
2
3
4
[root@mudns ~]# ls /etc/udev/rules.d/
60-fprint-autosuspend.rules  60-pcmcia.rules  60-raw.rules
70-persistent-cd.rules  70-persistent-net.rules  90-alsa.rules  90-hal.rules
98-kexec.rules  99-vmware-scsi-udev.rules

Edit the “persistent net” rule. Comment out the old rule with a #, and change eth1 to eth0` on the new rule when the MAC has changed.

1
2
3
4
5
6
7
8
9
10
11
12
[root@mudns ~]# vim /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x15ad:0x07b0 (vmxnet3) (custom name provided by external tool)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:aa:bb:cc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:cc:dd:ee", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

2. Network Script

Edit the ifcfg-eth0 network script, and change the HWADDR line

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@mudns ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
#HWADDR="00:0C:29:AA:BB:CC"
HWADDR="00:0C:29:CC:DD:EE"
ONBOOT=yes
BOOTPROTO=static
NETMASK=255.255.255.0
IPADDR=192.0.2.24
GATEWAY=192.0.2.1
IPV6INIT="yes"
IPV6ADDR="2001:DB8::224/32"
IPV6_DEFAULTGW="2001:DB8::1"
IPV6_AUTOCONF="no"
Type=Ethernet

3. Reboot

1
[root@mudns ~]# shutdown -r now

Comments