Change mac in openwrt build

Hi, Is it possible to add a custom mac address in openwrt build?

PS: whenever i flash an image, i want to get my custom mac address.

thanks

via uci-defaults script. check ones in /rom/etc/uci-defaults for inspiration.

basically this, but with MAC instead of wifi - I want to build a firmware with WiFi already enabled - #9 by openrouterman

also doable via rc.local as described in Generate a new random WAN MAC address at every boot

thanks your reply.
i want to change this

these are shown by default

thanks frollic, let me try with macchanger utility.

change or hide ?

want to change

Disable ip6 on them and they will not communicate on network ever at all.

ok i got it by using macchanger script and edited according to my need.
script is:

#!/bin/sh /etc/rc.common
#By krabelize | cryptsus.com
#MAC address changer script
#MAKE SURE the OUI of the MAC address matches a client side wireless NIC vendor
#Place this script in /etc/init.d/

START=94
STOP=20

start() {
   interface="wlan0"
   current_mac=$(ifconfig ${interface} | grep "HWaddr" | awk '{print$5}')
   new_mac=$(dd if=/dev/random bs=1 count=3 2>/dev/null | hexdump -C | head -1 | cut -d' ' -f2- | awk '{ print "34:36:3b:"$1":"$2":"$3 }')
   if [ $? -eq 0 ]; then
      ifconfig $interface down
      ifconfig $interface hw ether $new_mac
      ifconfig $interface up
         if [ $? -eq 0 ]; then
            logger "MAC address successfully changed for $interface from $current_mac to $new_mac"
            current_mac=$(ifconfig ${interface} | grep "HWaddr" | awk '{print$5}')
	    logger "New MAC address: $current_mac"
            exit 0
         else
            logger "MAC address changing scriped failed"
            exit 1
         fi
   else
      logger "Failed to generate MAC address. Perhaps you are missing certain system utilities"
      exit 1
   fi
}

stop() {
   echo "Stopping MAC changer script.."
}

make it executable

also place it in /etc/rc.local as 
/etc/init.d/macchanger.sh start

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.