Skip to content

Instantly share code, notes, and snippets.

@kmonticolo
Last active February 5, 2019 14:49
Show Gist options
  • Select an option

  • Save kmonticolo/c80bea0d7ec50615b39dbba9af868c8f to your computer and use it in GitHub Desktop.

Select an option

Save kmonticolo/c80bea0d7ec50615b39dbba9af868c8f to your computer and use it in GitHub Desktop.
MAC changer on Centos 7
#!/bin/bash
# kmonticolo 5.2.19
# follow installation https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/
MAC=$(cat /sys/class/net/ens32/address)
PATH=/etc/sysconfig/network-scripts/ifcfg-ens32
/bin/grep -q $MAC $PATH || /bin/sed -i "s/^HWADDR=.*$/HWADDR=$MAC/" $PATH
/sbin/service network restart
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment