openwrt-wan-mac
openwrt-wan-mac copied to clipboard
Only randomly generate last 3 octets
im trying to wrap my head around how to change it myself but cant see to figure it out.
I want to configure this to keep the first 3 octets so have the device show up as a specific vendor.
is there a way to only randomly generate the last 3 octets?
If you want to hardcode the first three octets as a string, try this instead of the original line in the script:
NEWMAC=$(printf "%s" "22:11:00" && hexdump -n3 -e'/1 ":%02x"' /dev/urandom)
or if you want to keep the first three octects of your real MAC address automatically:
NEWMAC=$(printf "%s" "${OLDMAC:0:8}" && hexdump -n3 -e'/1 ":%02x"' /dev/urandom)