Community discussions

MikroTik App
 
RyperX
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 72
Joined: Thu May 21, 2015 11:14 am

Automatic every x minutes change Wireless AP Interface MAC Adress

Fri Sep 02, 2016 12:12 pm

Hey guys,

i hope you can help me. I want to create a script that change every 30 minutes the mac adress of a virtuell wireless interface
I know i can set the mac with interface wireless set profile mac-address=xx......

But how would a script looks like when i want
interface wireless set profile mac-address=1234
wait 30mins
interface wireless set profile mac-address=4321
wait 30mins
interface wireless set profile mac-address=2222
wait 30mins
start again from beginning with mac 1234

Hopefully you can help me
 
raymondr15
Member Candidate
Member Candidate
Posts: 118
Joined: Fri Sep 05, 2014 1:11 am
Location: East London, South Africa
Contact:

Re: Automatic every x minutes change Wireless AP Interface MAC Adress

Thu Sep 15, 2016 12:30 am

Hey guys,

i hope you can help me. I want to create a script that change every 30 minutes the mac adress of a virtuell wireless interface
I know i can set the mac with interface wireless set profile mac-address=xx......

But how would a script looks like when i want
interface wireless set profile mac-address=1234
wait 30mins
interface wireless set profile mac-address=4321
wait 30mins
interface wireless set profile mac-address=2222
wait 30mins
start again from beginning with mac 1234

Hopefully you can help me
What is the reason you want to do this for?
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1286
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: Automatic every x minutes change Wireless AP Interface MAC Adress

Thu Sep 15, 2016 5:35 am

Here, this will generate a new mac address. It's dirty, but it works. just set the add a command to set the mac on the interface you want, then run the script every 30 minutes.
:local hexArray 0abcdef0123456789abcdef012345abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345
:local newMAC "";

:local hex1num [/system clock get time ];
:local hex2num [/system resource get cpu-load ];
:local rnd1num  [:pick $hex1num 6 8];
:local rnd2num  [:pick $hex2num];

:set newMAC ("D4:CA:6D:" .\
      [:tostr [:pick $hexArray ($rnd1num+$rnd2num) ]] .\
      [:tostr [:pick $hexArray ($rnd2num+4) ]] .":".\
      [:tostr [:pick $hexArray ($rnd1num+12) ]] .\
      [:tostr [:pick $hexArray ($rnd2num+1) ]] .":".\
      [:tostr [:pick $hexArray $rnd1num ]] .\
      [:tostr [:pick $hexArray ($rnd1num+$rnd2num+5) ]]  );

:log warning $newMAC;
 
RyperX
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 72
Joined: Thu May 21, 2015 11:14 am

Re: Automatic every x minutes change Wireless AP Interface MAC Adress

Mon Sep 26, 2016 11:43 am


What is the reason you want to do this for?
Streetpassing for 3DS
Here, this will generate a new mac address. It's dirty, but it works. just set the add a command to set the mac on the interface you want, then run the script every 30 minutes.
:local hexArray 0abcdef0123456789abcdef012345abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345
:local newMAC "";

:local hex1num [/system clock get time ];
:local hex2num [/system resource get cpu-load ];
:local rnd1num  [:pick $hex1num 6 8];
:local rnd2num  [:pick $hex2num];

:set newMAC ("D4:CA:6D:" .\
      [:tostr [:pick $hexArray ($rnd1num+$rnd2num) ]] .\
      [:tostr [:pick $hexArray ($rnd2num+4) ]] .":".\
      [:tostr [:pick $hexArray ($rnd1num+12) ]] .\
      [:tostr [:pick $hexArray ($rnd2num+1) ]] .":".\
      [:tostr [:pick $hexArray $rnd1num ]] .\
      [:tostr [:pick $hexArray ($rnd1num+$rnd2num+5) ]]  );

:log warning $newMAC;
Thanks but its important that i can specify the needed mac adress. A random one will not work

Who is online

Users browsing this forum: No registered users and 28 guests