Created
November 26, 2012 07:08
-
-
Save KellyLSB/4146970 to your computer and use it in GitHub Desktop.
Updates a cloned Parallels Ubuntu VM network interface configuration with the proper mac address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# | |
# Change the MAC Address on an Ubuntu Parallels Cloned VM | |
# Author: Kelly Becker (KellyLSB) | |
# Check for sudo access | |
SUDO=`sudo -n uptime 2>&1|grep "load"|wc -l` | |
if [ $SUDO -lt 1 ] | |
then | |
echo "You need to have sudo priveleges!" | |
exit | |
fi | |
NEW_MAC=`sudo lshw -C network | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'` | |
UDEV_RULE=/etc/udev/rules.d/70-persistent-net.rules | |
# Make the change | |
echo "Updating the udev mac address to $NEW_MAC..." | |
sudo sed -ie "s/\([[:xdigit:]]\{1,2\}:\)\{5\}[[:xdigit:]]\{1,2\}/$NEW_MAC/g" $UDEV_RULE | |
# Restarting the computer | |
echo "Restarting VM" | |
sleep 5 | |
sudo shutdown -r now | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this works great. ... thank you saved me an hour.