Hey everyone, I have a problem, I created an script to get the IP address that is given to a certain MAC address and put that IP on a list, which I block some sites. The thing is, when I paste the script on the terminal, works perfectly, but in the script option of the mikrotik, it doesn’t run, here is the script:
/ip firewall address-list add list=CELULAR address=[/ip dhcp-server lease get number=[find mac-address=XX:XX:XX:XX:XX:XX] address];
sorry for my english, I’m a foreign guy 
For static leases, regardless if are active or not:
/ip firewall address-list add list="CELULAR" address=[/ip dhcp-server lease get [find where mac-address=XX:XX:XX:XX:XX:XX] value-name=address];
For dynamic leases:
/ip firewall address-list add list="CELULAR" address=[/ip dhcp-server lease get [find where active-mac-address=XX:XX:XX:XX:XX:XX] value-name=address];
For static leases, if is also active:
/ip firewall address-list add list="CELULAR" address=[/ip dhcp-server lease get [find where active-mac-address=XX:XX:XX:XX:XX:XX and mac-address=XX:XX:XX:XX:XX:XX] value-name=address];
Hello Rextended, what mac must fill in address=XX:XX:XX:XX:XX:XX
All the mac addresses from the clients?
Not, is only one generic placeholder.
Must be set manually the right MAC or automatically by function, one by one.
thanks for the answer rextender, but, the problem continues, here is the script I’ve created:
/ip firewall address-list remove number=[find list=“Celulares”];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=B0:D0:9C:9E:08:91] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=A4:77:60:47:16:6C] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=C8:D1:0B:DF:9F:9A] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=CC:07:AB:0B:69:A9] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=24:C6:96:7E:EA:8A] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=10:D5:42:11:C4:AB] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=F8:E0:79:FA:7E:F1] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=68:76:4F:10:18:1B] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=1C:AF:05:C3:EB:06] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=CC:FA:00:A1:45:B5] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=38:0A:94:A4:71:84] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=1C:AF:05:BD:7E:4F] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=14:49:E0:5F:8D:E8] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=94:51:03:E8:AB:68] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=54:79:75:19:2C:25] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=14:49:E0:5F:8D:E8] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=1C:AF:05:BD:7E:4F] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=38:0A:94:A4:71:84] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=54:79:75:19:2C:25] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=A0:F3:C1:7B:3C:97] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=24:F5:AA:4C:D1:D5] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=2C:41:38:48:70:3D] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=A4:77:60:47:16:6C] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=DC:F1:10:E5:CA:34] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=CC:07:AB:0B:69:A9] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=24:C6:96:7E:EA:8A] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=10:D5:42:11:C4:AB] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=1C:AF:05:B1:3F:A8] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=68:76:4F:10:18:1B] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=84:38:38:34:20:8A] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=24:C6:96:7C:ED:3E] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=1C:AF:05:C3:EB:06] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=00:26:10:00:57:81] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=58:A2:B5:AC:D8:2D] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=60:BE:B5:3E:A0:F3] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=64:1C:67:63:A9:1E] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=00:1A:3F:79:F2:70] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=00:1A:3F:6D:F2:F0] value-name=address];
/ip firewall address-list add list=“Celulares” address=[/ip dhcp-server lease get [find where active-mac-address=FC:92:3B:EC:99:88] value-name=address];
detail: when I paste the whole syntax at the terminal, It works perfectly.
the syntax is correct?
tnx
first line mus be:
/ip firewall address-list remove [find where list=“Celulares”];
where you get the mac address?
you have one separate lists on pc or you read somewere on routeros?
If you have a list, create one static DHCP lease for each device on one range out of your pool, this is simpler.
Remember, if user set static IP on his device, with your method or with static lease, can bypass the block…
The best is use hotspot or web-proxy function and block all the sites you want by traffic coming from wireless.
If you need to connect other authorized devices on wireless then can to do everything, create one VirtualAP with (different) password
But also with this methods still persist problems with https connections.
On the firm, we need to block access by the cellphones, the thing is, the firm is a computer store and the people who work here need to knows the password of wifi and they know how to use a proxy, and some smartphones need to access to the internet, that is why I need to block by the MAC address of the cell phones, I blocked everyone, and when an authorized person ask me about the error on the internet I remove the mac address from that blocking list.
tnx for the reply