1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing WAN MAC address every 24 hours?

Discussion in 'Tomato Firmware' started by p2hicy, Oct 20, 2008.

  1. p2hicy Addicted to LI

    Hi!

    I'd like to know if someone knows how to get Tomato 1.21 to change its MAC address on the WAN-side every 24 hours. Reason for this, I want a fresh IP every day. I hadn't found anything on the web-interface, so I guess this has to be done using scripts. I hoped to get some help here, since I'm not really in to that scripting stuff. Or maybe some other advice.

    Thanks :)
  2. This is the script i use, run one a day via Administration > Scheduler


    Code:
    #http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Auto_Random_MAC_Address
    
    MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'` 
    nvram set wan_hwaddr="00:${MAC}"
    ifconfig vlan1 down
    ifconfig vlan1 hw ether 00:${MAC}
    ifconfig vlan1 up
  3. p2hicy Addicted to LI

    Thanks for the script, works perfectly.
  4. p2hicy Addicted to LI

    Strange, it seems it stopped working with 1.23, the MAC won't change anymore. It only kills my Internet access. Anyone can confirm that?
  5. fairuza New Member

    so how come this doesn't work anymore?

    also, what happens exactly when it changes the mac address and gets a new ip while you are in middle of doing something, like torrenting? it would kill everything and have to reconnect right?
  6. pfoomer New Member

    In all probability, yes, , the same as if you did it manually, it restarts some services, which causes a disconnect.

    Try

    Advanced. MAC Address


    Edit: Maybe initiating the change on disconnect, either manually or timeout would be a better solution?
  7. callous LI Guru

    Sometimes changing the mac address requires a reboot of the modem for the ip to come through to your router from the modem.

    I do this manually for this reason. I use 1 ip for bt and 1 ip for everything else ;)
  8. p2hicy Addicted to LI

    It worked before 1.23, and I reboot the modem the same time I change the MAC address on the router via curl on another computer. So the problem must be in 1.23.
  9. nvtweak New Member

    MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
    nvram set mac_wan="00:${MAC}"
    service wan restart
  10. p2hicy Addicted to LI

    That works :)
    Much appreciated.
  11. Anubis14 Networkin' Nut

    Thank you for this. been looking high and low. Hopefully it works with v1.25. :)


  12. azdps Networkin' Nut

    This thread helped me out a while back when I wanted to change my mac addresses at certain times. Here is what I use for my Asus RT-N66U, which has two wireless mac addresses. Keep in mind that my Motorola modem requires a reboot.

    Code:
    MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
    nvram set lan_hwaddr="00:${MAC}"
    MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
    nvram set wan_hwaddr="00:${MAC}"
    MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
    nvram set wl0_hwaddr="00:${MAC}"
    MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
    nvram set wl1_hwaddr="00:${MAC}"
    nvram commit
    wget http://192.168.100.1/reset.htm?reset_modem=Restart+Cable+Modem
    sleep 30
    reboot 

Share This Page