Programster's Blog

Tutorials focusing on Linux, programming, and open source

Cloning CentOS Guests - Disable MAC

Today I was scratching my head trying to figure out why my changes to the network to go from DHCP to static IP was not taking effect on my CentOS 7 guest. It turns out that the network configuration is defaulted to including the HWADDR (MAC) address as shown below:

# Generated by dracut initrd
NAME="eth0"
HWADDR=52:54:00:4D:24:AA
ONBOOT=yes
NETBOOT=yes
UUID="dd66e666-87dc-4814-a862-61b8411c2c3d"
IPV6INIT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

When you clone a guest, the new guest is given a new MAC address but your network scripts will not be automatically updated. If your guests only have 1 NIC then you can just comment the HWADDR line out and your guests will still work. Thus you can keep cloning without having to remember to update the MAC.

References