Skip to content

Instantly share code, notes, and snippets.

@aspring
Last active December 21, 2015 15:39
Show Gist options
  • Save aspring/6328332 to your computer and use it in GitHub Desktop.
Save aspring/6328332 to your computer and use it in GitHub Desktop.
An init.d script that can be used to overcome the MAC address changes when copying a virtual machine. This has been tested on Centos. To utilize this script, add it to init.d, then link it to rc3.d: ln -s /etc/init.d/removepersistentnetrules /etc/rc.d/rc3.d/S99removepersistentnetrules
#!/bin/bash
FIRSTBOOT="/etc/.firstboot"
if [ ! -f $FIRSTBOOT ];
then
# Remove the first boot files
rm -f /etc/udev/rules.d/70-persistent-net.rules
# Restart the network service
service network restart
# Touch file so this does not run again
touch $FIRSTBOOT
# Restart the system so that it picked up the change
shutdown -r now
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment