Since I'm going to start learning puppet I figured I'm going to be building and destroying a lot of linux VM's so I might as well create a template. Following my previous post I create a base template VM with the minimal install of Centos and all the required updates. Once created you need to edit the following file to remove IP and MAC address details:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Remove the following entries then save and exit:
HWADDR="xx:xx:xx:xx:xx:xx"
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
Now edit the following file and remove all entries that have a MAC address then save and exit:
vi /etc/udev/rules.d/70-persistent-net.rules
an example would be to remove the following text:
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx.xx.xx.xx.xx.xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
Once completed power off the VM and remove and re-add the network adapter from the VM (This ensures that a new MAC address is generated). Finally convert the VM to a template and test. Once you have created a new VM from the template you will need to do the following:
Change the hostname (including domain name i.e. server.domain.local)
Add IP address information including the new MAC address as per this post
No comments:
Post a Comment