Created
October 28, 2017 00:27
-
-
Save rcg4u/91cb1a17750397082910180aa075a12e to your computer and use it in GitHub Desktop.
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
#/bin/bash | |
# change the mac | |
wan1="eth1.2" | |
wan2="eth1" | |
/sbin/ifconfig $wan1 down | |
/sbin/ifconfig $wan2 down | |
echo "Both Interfaces down" | |
echo "Generating a new mac address" | |
#macadd=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/:$//') | |
macadd="$1" | |
newmac=$(echo "$macadd") | |
sleep 2 | |
/sbin/ifconfig $wan1 hw ether $(echo "$newmac") | |
/sbin/ifconfig $wan2 hw ether $(echo "$newmac") | |
echo "Both interfaces back up with updated mac address $macadd" | |
/sbin/ifconfig $wan1 up | |
/sbin/ifconfig $wan2 up | |
/sbin/uci set network.wan6.macaddr="$(echo "$newmac")" | |
/sbin/uci set network.wan.macaddr="$(echo "$newmac")" | |
echo "Mac address set to $newmac restart your cable modem" | |
echo "Settings verified" | |
/sbin/uci get network.wan6.macaddr | |
/sbin/uci get network.wan.macaddr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment