Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out a way to invoke the "mac clone" command found under the "setup" menu in DD-WRT v24SP2. I can do it in the GUI (of course), but I want to place it in a script so that I can cron and randomize it.

Perhaps it would be best if I explained my plight? What I want to create is a script that I can run that will randomly set the MAC address of the router to get a new IP address. I've tried many different scripts , but none seem to work with my router model (Buffalo WZR-HP-G300NH). After giving up on scripts, I decided to try using the built in "MAC clone" function in the GUI; It worked like a charm. Unfortunately, I can't exactly cron the GUI, nor can I have it select the MAC randomly from the GUI.

Here is what I have to set the MAC to a random value:

MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
echo "00:${MAC}"

The echoed value is the randomly generated MAC address (it always starts with 00, I know it's bad.).

So (bad grammar), the question I have is: How do I call whatever built-in function is used to clone the MAC address using the above script?

Thanks in advance!

share|improve this question
up vote 0 down vote accepted

There are some command line options which I think you are looking for... these are as follows:


1 turns the MAC cloning on and 0 turns it off



The random MAC address you want goes in both... I am not sure what the difference is but in my configuration, they are both the same.

share|improve this answer
I'll test this and get back to you – VerTiGo_Etrex May 5 '11 at 14:18
This appears to be right. I was missing "mac_clone_enable" in my script. Unfortunately, it appears as though my ISP's dhcp server doesn't like certain macs... oh well... – VerTiGo_Etrex May 5 '11 at 14:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.