Skip to content

Instantly share code, notes, and snippets.

@alex4u2nv
Last active December 31, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex4u2nv/7967308 to your computer and use it in GitHub Desktop.
Save alex4u2nv/7967308 to your computer and use it in GitHub Desktop.
Update the network interface for a cloned linux virtual machine
ifconfig eth1 up && eth1=`ifconfig | grep eth1 | sed 's/.*HWaddr //g'` && cat /etc/sysconfig/network-scripts/ifcfg-eth0 | sed "s/HWADDR.*/HWADDR=$eth1/" | sed "s/eth0/eth1/g" > /etc/sysconfig/network-scripts/ifcfg-eth1 && rm /etc/sysconfig/network-scripts/ifcfg-eth0 && service network restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment