Community discussions

MikroTik App
 
TAD
just joined
Topic Author
Posts: 12
Joined: Tue Mar 13, 2012 12:17 pm

Limit Mobile Device Using Script

Fri Feb 02, 2018 1:28 pm

Hi All please need ur help, i have bin tring to configure this scrip that help to auto discover and manage mobil device banwigth but not working for me.
Need Help please

/ ip firewall layer7-protocol
add name = android regexp = "(^(android|Android|BLACKBERRY|MITO|CIMB|Windows|iphone|iPhone|ipad|iPad|BLACKBER).*$)

: global layer7 [/ ip firewall layer7-protocol find name = "android"]
: global regexandroid [/ ip firewall layer7-protocol get $ layer7 regexp]
# pay attention to this section
: global net 192.168.3.
: for e from = 2 to = 62 do = {
: global iddhcp [/ ip dhcp-server lease find address = ($ net. $ e)];
: if ([: len $ iddhcp]> 0) do = {
: local hostname [/ ip dhcp-server lease get $ iddhcp host-name];
: if ($ hostname ~ $ regexandroid = true) do = {
: global halah [/ queue simple find name = ($ net. $ e)]
: if ([: len $ halah]> 0) do = {
/ queue simple remove ($ net. $ e)
/ queue simple add name = ($ net. $ e) comment = "$ hostname" \
($ net $ e) \
max-limit = 512000/512000
: log info "Query already exists. ($ hostname) ip = $ net $ e deleted"}
: if ([: len $ halah] < = 0) do = {
/ queue simple add name = ($ net. $ E) \
target-addresses = ($ net. $ E) comment = "$ hostname" \
max-limit = 512000/512000
: log warning "query android found: ($ hostname) ip = $ net $ e added "}
} else = {
: global halah [/ queue simple find name = $ net. $ e]
: if (hostname = "") do = {
: if ([: len $ halah]> 0) do = {
/ queue simple remove ($ net. $ e)
/ queue simple add name = ($ net. $ e) comment = "empty hostname tp active" \
target-addresses = ($ net. $ e) \
max-limit = 1000000/1000000
: log info "active hostname unknown: $ hostname ip = $ net $ e remove add "}
: if ([: len $ halah] <= 0) do = {
/ queue simple add name = ($ net. $ e) \
target-addresses = ($ net. $ e) comment = "empty hostname tp active" \
max-limit = 1000000/1000000
: log info "active hostname unknown: $ hostname ip = $ net $ e add"
} else = {
: if ([: len $ halah]> 0) do = {
/ queue simple remove ($ net.$ e)
/ queue simple add name = ($ net. $ e) comment = "$ hostname" \
target-addresses = ($ net. $ e) \
max-limit = 2000000/2000000
: log info "instead: $ hostname ip = $ net $ e remove add "}
: if ([: len $ halah] <= 0) do = {
/ queue simple add name = ($ net. $ e) \
target-addresses = ($ net. $ e) comment = "$ hostname" \
max-limit = 2000000/2000000
: log info "instead: $ hostname ip = $ net $ e add"}
}
}
} else = {
: global halah [/ queue simple find name = ($ net. $ e)]
: if ([: len $ halah]> 0) do = {
/ queue simple remove ($ net. $ e)
comment = "empty" \
target-addresses = ($ net. $ e) \
max-limit = 1000000/1000000
: log info "instead: ... ip = $ net $ e remove add"}
: if ([: len $ halah] <= 0) do = {
/ queue simple add name = ($ net. $ e) \
target- address = ($ net. $ e) comment = "empty" \
max-limit = 1000000/1000000
: log info "instead: .. ip = $ net $ e add"}
}
}

Who is online

Users browsing this forum: Bing [Bot] and 7 guests