Last active
February 5, 2019 14:49
-
-
Save kmonticolo/c80bea0d7ec50615b39dbba9af868c8f to your computer and use it in GitHub Desktop.
MAC changer on Centos 7
This file contains hidden or 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
| #!/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