Skip to content

Instantly share code, notes, and snippets.

Created August 11, 2014 08:17
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 anonymous/63cc55f3397db9de1ec6 to your computer and use it in GitHub Desktop.
Save anonymous/63cc55f3397db9de1ec6 to your computer and use it in GitHub Desktop.
random_mac(){
local i; for i in wireless.@wifi-iface[0] network.lan; do
local mac; while [ "${#mac}" != "17" ]; do
mac=00$(hexdump -n5 -e '/1 ":%02x"' /dev/urandom)
done
echo ${mac}
uci set ${i}.macaddr=${mac}
uci commit ${i%%.*}
unset mac
done
}t random_mac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment