139. Mikrotik How to Block Mobile Phone From Accessing the Internet


You can contact me: plus.google.com/+PhallaCCMT; youtube.com/phallaccmt; facebook.com/Phalla.CCMT; twitter.com/PhallaCCMT and Phalla.CCMT@gmail.com

Script:

#DHCP-Server Name
:local DHCPServer "Guest";

#PhallaCCMT.blogspot.com
:foreach i in=[/ip dhcp-server lease find dynamic=yes active-server=$DHCPServer] do={
:local DhcpDynMAC [/ip dhcp-server lease get $i mac-address];
:local DhcpDynCLIENTID [/ip dhcp-server lease get $i active-client-id];
:local DhcpDynHOST [/ip dhcp-server lease get $i host-name];
:local phoneNAME [:pick $DhcpDynHOST 0 4];

#YouCanAddMorePhone
:if ( ($phoneNAME="BLUS") || ($phoneNAME="iPad") || ($phoneNAME="andr") || ($phoneNAME="Andr") || ($phoneNAME="Wind") || ($phoneNAME="iPho") || ($phoneNAME="BLAC") ) do={
/ip dhcp-server lease add block-access=yes mac-address="$DhcpDynMAC" use-src-mac=yes comment="$DhcpDynHOST" server="$DHCPServer" client-id="$DhcpDynCLIENTID";
}
}
/ip dhcp-server lease remove [find host-name~"BLUS*"]
/ip dhcp-server lease remove [find host-name~"android*"]
/ip dhcp-server lease remove [find host-name~"Android*"]
/ip dhcp-server lease remove [find host-name~"Windows*"]
/ip dhcp-server lease remove [find host-name~"iPad*"]
/ip dhcp-server lease remove [find host-name~"iPhone*"]
/ip dhcp-server lease remove [find host-name~"BLACKBERRY*"]

#

Previous
Next Post »

3 comments

Write comments
Unknown
AUTHOR
January 26, 2018 at 5:00 AM delete

Very usefull your script!! Is it possible to place an exception on the script, for i.e: iPhoneManager to be able to access internet? Thank you!

Reply
avatar
Faiza_Hacks
AUTHOR
April 9, 2018 at 9:44 AM delete

I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. Blockchain PR

Reply
avatar
August 23, 2018 at 2:03 PM delete

i made some arrangement for don't remove the statics one, so i can release some mobiles


:foreach j in=[/ip dhcp-server lease find dynamic=yes active-server=$DHCPServer] do={
:local DhcpDynHOST [/ip dhcp-server lease get $j host-name];
:local phoneNAME [:pick $DhcpDynHOST 0 4];
:if ( ($phoneNAME="BLUS") || ($phoneNAME="iPad") || ($phoneNAME="andr") || ($phoneNAME="Andr") || ($phoneNAME="Wind") || ($phoneNAME="iPho") || ($phoneNAME="BLAC") || ($phoneNAME="Gala") ) do={
/ip dhcp-server lease remove $j
}
}

Reply
avatar