افضل تقسيم

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 16

�� ����������

/ip hotspot user profile


set [ find default=yes ] on-login="/system script run odai" on-logout="/system
script run odai"

{
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
:if ($uname="xzex6060" || $uname="jalalali" || $uname="zexxx89" || $uname="779thp"
|| $uname="zeexx4444" || $uname="4935830" || $uname="zexx1735" || $uname="noorh" ||
$uname="184904" || $uname="aa7968" || $uname="moad" || $uname="zexx188") do={
/queue simple add name=$uname target=$addr packet-marks=client_download max-
limit="50k/256k";
}

}
}

ip hotspot user remove [ find disabled ]

���� �������� ���� ���� maxupgrade


-------------------
����� + ��� ���
v6

{
:local i;
:local j 9144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i address];
/queue simple add name=$uname target=$addr packet-marks=maxupgrade
max-limit="$y/$x" queue=ethernet-default/ethernet-default;
:local macby;
:local addrby;
:foreach m in=[/ip hotspot ip-binding find where bypassed] do={
:set addrby [/ip hotspot ip-binding get $m to-address];
:set macby [/ip hotspot ip-binding get $m mac-address];
/queue simple add name=$macby target=$addrby max-limit="$y/$x" queue=ethernet-
default/ethernet-default;
}
}
}
���� ��� ����
v6

{
:local i;
:local j 6144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:local macby;
:local addrby;
:foreach m in=[/ip hotspot ip-binding find] do={
:set addrby [/ip hotspot ip-binding get $m to-address];
:set macby [/ip hotspot ip-binding get $m mac-address];
/queue simple add name=$macby target=$addrby max-limit="$y/$x" q ueue=ethernet-
default/ethernet-default;
}
}

������ ���� ����� ���� ��� " ���� �� ������� " ���� ����� ��� ��� ��������
/queue simple set [ find name=odaiyd20202 ] max-limit=464k/1000k;
/ip hotspot user set [ find email=8@0_250.ptd ] email=8@0_500.ptd

/ip hotspot user set [ find email=8@0_250.ptd ] email=8@0_500.ptd

hk88wa
----------
����� ���
v5

{:local i;
:local j 6144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];

/queue simple add name=$uname target=$addr max-limit="$y/$x";

}
}

-------------

����� �� ���� ������ .. ���� ��� ������� ���� ��� ������

���� ������ ������ ������� ����������


https://www.facebook.com/MaxNet.yemen
+967-1211991
+967-771204505
+967-736024667
+967-777370986

======================
-binding
{
:local i;
:local j 12144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:local macby;
:local addrby;
:foreach m in=[/ip hotspot ip-binding find] do={
:set addrby [/ip hotspot ip-binding get $m to-address];
:set macby [/ip hotspot ip-binding get $m mac-address];
/queue simple add name=$macby target=$addrby max-limit="$y/$x" queue=ethernet-
default/ethernet-default;
}
}

{
:local i;
:local j 14144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:local b 90000;
:local a ($x+$b);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
/queue simple add name=$uname target=$addr max-limit="$y/$x" burst-limit="$y/$a"
burst-threshold="$y/$a" burst-time="4/4" packet-marks=from_web;
}
}
/queue simple set [find name=oyd19912] max-limit=264k/3M;
=============================

{
:l{:local i;
:local j 8144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
/queue simple add name=$uname target=$addr packet-mark=from_web max-limit="$y/$x";
:local macby;
:local addrby;
:foreach m in=[/ip hotspot ip-binding find where bypassed] do={
:set addrby [/ip hotspot ip-binding get $m to-address];
:set macby [/ip hotspot ip-binding get $m mac-address];
/queue simple add name=$macby target=$addrby max-limit="$y/$x" queue=ethernet-
default/ethernet-default;
}
}
}

=============
/ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark=all
passthrough=no
/queue type add name="PCQ_download" kind=pcq pcq-rate=64000 pcq-classifier=dst-
address
/queue type add name="PCQ_upload" kind=pcq pcq-rate=32000 pcq-classifier=src-
address

/ip firewall mangle add chain=prerouting action=mark-packet \ in-interface=ether1-


LAN new-packet-mark=client_upload
/ip firewall mangle add chain=prerouting action=mark-packet \ in-interface=ether2-
WAN new-packet-mark=client_download

===========================
/ip firewall mangle
add action=mark-packet chain=prerouting comment=pcq-max-limited dst-
address=10.55.24.1 new-packet-mark=from_web

=================finish=================
"\r\
\n{\r\
\n :global date [ /system clock get date ]\r\
\n :global array ( \"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\",\"jul\",\
\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" )\r\
\n :global numday ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 )\r\
\n :global days [ :pick \$date 4 6 ]\r\
\n :global tax [ :pick \$date 0 3 ]\r\
\n :global happy [ :pick \$date 7 11 ]\r\
\n :global months ([ :find \$array \$tax] )\r\
\n :for nodays from=0 to=\$months do={\r\
\n :set days ( \$days + [ :pick \$numday \$nodays ] )\r\
\n }\r\
\n :global daynow (\$days + (\$happy * 365))\r\
\n/ip hotspot active\r\
\n:foreach user in=[find] do={\r\
\n:global active [get \$user user]\r\
\n/ip ho user\r\
\n:foreach use in=[find name=\$active] do={\r\
\n:global comm [get \$use comment]\r\
\n:global byte ([get \$use bytes-out]/1074000000)\r\
\n :local mail [:tostr [get \$use email]];\r\
\n :global limit [:pick \$mail -1 [:find \$mail \"@\"]];\r\
\n:if ( \$comm < 5000 ) do={[set \$use comment=(\$comm + \$daynow) ]} else={\
\r\
\n:if ( ( \$daynow - \$comm) >= \"1\" ) do={[remove \$use ]}\r\
\n:if ( \$byte >= \$limit ) do={[set \$use profile=\"low\" ]\r\
\n/ip ho active remove [find user=\$active]} \r\
\n:if ( \$comm <= \$daynow ) do={[set \$use profile=\"finish\" ]\r\
\n/ip ho active remove [find user=\$active]}\r\
\n/ppp active\r\
\n:foreach ppuser in=[find] do={\r\
\n:global ppactive [get \$ppuser name]\r\
\n/ppp secret\r\
\n:foreach ppuse in=[find name=\$ppactive] do={\r\
\n:global ppcomm [get \$ppuse comment]\r\
\n:if ( \$ppcomm < 5000 ) do={[set \$ppuse comment=(\$ppcomm + \$daynow) ]} \
\r\
\n:if ( ( \$daynow - \$ppcomm) >= \"1\" ) do={[remove \$ppuse ]} \r\
\n:if ( \$ppcomm <= \$daynow ) do={[set \$ppuse profile=\"finish\" ]\r\
\n/ppp active remove [find name=\$ppactive]\r\
\n}}}}}}}"
==============================================

/ip firewall mangle


add action=mark-packet chain=prerouting comment=pcq-max-limited dst-address=\
!10.0.0.1 new-packet-mark=from_web

===================

{
:local i;
:local j 9144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];

/queue simple add name=$uname target=$addr packet-marks=max max-limit="$y/$x";

}
}
{
:local i;
:local content;
:local j 9144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:foreach i in=[/queue simple find] do={
:set content [/queue simple get $i comment];
if ($content != "*") do={
/queue simple remove $i;
}
}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];

/queue simple add name=$uname target=$addr packet-mark=from_web


max-limit="$y/$x";

}
}

{
:local i;

:local j 8144000;

:set i [ :len [/ip hotspot active find] ];

:if ($i=0) do={:set i 1;}

:local x ($j/$i);

:local y ($x/4);

:foreach i in=[/queue simple find] do={/queue simple remove $i;}

:local addr;

:local uname;

:foreach i in=[/ip hotspot active find] do={

:set addr [/ip hotspot active get $i address];

:set uname [/ip hotspot active get $i user];

/queue simple add name=$uname target=$addr packet-mark=from_odai


max-limit="$y/$x";

}
}

/ip address
add address=192.168.1.4/24 interface=ether1 network=192.168.1.0
add address=192.168.22.1/24 interface=wlan1 network=192.168.22.0
add address=192.168.40.1/22 interface=ether2 network=192.168.40.0
add address=10.66.77.1/22 interface=ether3 network=10.66.76.0
add address=10.98.122.1/22 interface=ether4 network=10.98.120.0
add address=192.168.222.1/22 interface=ether5 network=192.168.220.0
add address=10.177.11.1/22 interface=ether7 network=10.177.8.0
add address=172.20.177.1/22 interface=ether8 network=172.20.176.0
add address=192.168.114.1/22 interface=ether9 network=192.168.112.0
add address=10.180.23.1/22 interface=ether10 network=10.180.20.0
add address=222.55.22.1/22 interface=ether6 network=222.55.20.0

=======================HotspotGhost==========================

# define variables
:local addr
:local toaddr
:log info "Start Ghost Hotspot Script"

:foreach i in=[/ip hotspot host find] do={


:set addr [/ip hotspot host get $i address]
:set toaddr [/ip hotspot host get $i to-address]
# :log info "address = $addr and to-address = $toaddr"
:if ($addr != $toaddr) do={
# we found one to clear
:log info "clear address = $addr and to-address = $toaddr with # $i"
/ip hotspot host rem $i
}
}
:log info "Ghost Hotspot Script Complete"

================���� �������� ������ ��� ���������


/system scheduler
add comment="" disabled=no interval=10m name=HotspotGhost on-event=\
HotspotGhost policy=read,write,policy start-date=jan/01/1970 start-time=\
00:00:00

===================================================

/ip firewall mangle


add action=mark-packet chain=prerouting dst-address=!10.0.0.1 new-packet-
mark=maxupgrade-down passthrough=no
add action=mark-packet chain=prerouting new-packet-mark=maxupgrade-down
passthrough=no src-address=10.0.0.0/24

===================================================
{:local i;
:local j 8144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];

/queue simple add name=$uname target=$addr packet-marks=from_web


max-limit="$y/$x";

}
}

=========================
/ip firewall mangle
add action=mark-packet chain=prerouting comment=pcq-max-limited dst-address=\
!10.22.5.1 new-packet-mark=from_web

=========
{:local i;
:local j 9144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/3);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
:if ($uname = "oyd19912") do={
/queue simple add name=$uname target=$addr packet-mark=from_web max-
limit="100k/256k";
}else={
:if ($uname ="odai20162") do={
/queue simple add name=$uname target=$addr packet-mark=from_web max-
limit="100k/256k";

}else={
:if ($uname ="nab2016") do={
/queue simple add name=$uname target=$addr packet-mark=from_web max-
limit="100k/256k";

} else={
/queue simple add name=$uname target=$addr packet-marks=from_web
max-limit="$y/$x";
}
}
}
}
}
:foreach i in=[/queue simple find ] do={
:set content [/queue simple get \$i comment;]
:set mainqueue [/queue simple get \$i name;]
:if (\$content != "*") do={

:foreach i in=[/tool user-manager user find] do={


:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
/queue simple set [ find caller-id=bind] caller-id=""

}
tool user-manager user set caller-id="bind"

==================
123 14��
132 13��
143 12��
156 11��
173 10��
193 9��
215 8��

/ip firewall mangle


add action=mark-connection chain=input in-interface=ether1 new-connection-
mark=wan1_conn
add action=mark-connection chain=input in-interface=ether2 new-connection-
mark=wan2_conn
add action=mark-routing chain=output connection-mark=wan1_conn hotspot=auth new-
routing-mark=wan1 passthrough=yes
add action=mark-routing chain=output connection-mark=wan2_conn hotspot=auth new-
routing-mark=wan2 passthrough=yes
add action=mark-connection chain=prerouting dst-address-type=!local in-
interface=bridge1 new-connection-mark=wan1_conn passthrough=yes per-connection-
classifier=\
both-addresses-and-ports:2/0
add action=mark-connection chain=prerouting dst-address-type=!local in-
interface=bridge1 new-connection-mark=wan2_conn passthrough=yes per-connection-
classifier=\
both-addresses-and-ports:2/1
add action=mark-routing chain=prerouting connection-mark=wan1_conn in-
interface=bridge1 new-routing-mark=wan1
add action=mark-routing chain=prerouting connection-mark=wan2_conn in-
interface=bridge1 new-routing-mark=wan2
add action=mark-packet chain=prerouting comment=pcq-max-limited dst-address=!
10.0.0.1 new-packet-mark=from_web passthrough=no

=========================

/ip firewall mangle


add chain=input in-interface=ether1 action=mark-connection new-connection-
mark=wan1_conn
add chain=input in-interface=ether2 action=mark-connection new-connection-
mark=wan2_conn

add chain=output connection-mark=wan1_conn action=mark-routing new-routing-


mark=wan1
add chain=output connection-mark=wan2_conn action=mark-routing new-routing-
mark=wan2

add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=bridge1


add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=bridge1

add chain=prerouting dst-address-type=!local in-interface=bridge1 per-connection-


classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-
mark=wan1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=bridge1 per-connection-
classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-
mark=wan2_conn passthrough=yes
add chain=prerouting connection-mark=wan1_conn in-interface=bridge1 action=mark-
routing new-routing-mark=wan1
add chain=prerouting connection-mark=wan2_conn in-interface=bridge1 action=mark-
routing new-routing-mark=wan2

/ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=wan1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=wan2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

/ip firewall mangle


add action=mark-connection chain=input in-interface=WAN1 new-connection-
mark=WAN1_conn
add action=mark-connection chain=input in-interface=WAN2 new-connection-
mark=WAN2_conn
add action=mark-connection chain=input in-interface=WAN3 new-connection-
mark=WAN3_conn
add action=mark-connection chain=input in-interface=WAN4 new-connection-
mark=WAN4_conn
add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-
mark=to_WAN1
add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-
mark=to_WAN2
add action=mark-routing chain=output connection-mark=WAN3_conn new-routing-
mark=to_WAN3
add action=mark-routing chain=output connection-mark=WAN4_conn new-routing-
mark=to_WAN4
add action=mark-connection chain=prerouting comment=LoadBalance dst-address-type=!
local in-interface=LAN_H new-connection-mark=WAN1_conn per-connection-classifier=\
both-addresses-and-ports:4/0
add action=mark-connection chain=prerouting dst-address-type=!local in-
interface=LAN_H new-connection-mark=WAN2_conn per-connection-classifier=\
both-addresses-and-ports:4/1
add action=mark-connection chain=prerouting dst-address-type=!local in-
interface=LAN_H new-connection-mark=WAN3_conn per-connection-classifier=\
both-addresses-and-ports:4/2
add action=mark-connection chain=prerouting dst-address-type=!local in-
interface=LAN_H new-connection-mark=WAN4_conn per-connection-classifier=\
both-addresses-and-ports:4/3
add action=mark-routing chain=prerouting connection-mark=WAN1_conn in-
interface=LAN_H new-routing-mark=to_WAN1
add action=mark-routing chain=prerouting connection-mark=WAN2_conn in-
interface=LAN_H new-routing-mark=to_WAN2
add action=mark-routing chain=prerouting connection-mark=WAN3_conn in-
interface=LAN_H new-routing-mark=to_WAN3
add action=mark-routing chain=prerouting connection-mark=WAN4_conn in-
interface=LAN_H new-routing-mark=to_WAN4

/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1
add check-gateway=ping distance=2 gateway=192.168.2.1 routing-mark=to_WAN1
add check-gateway=ping distance=3 gateway=192.168.3.1 routing-mark=to_WAN1
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2
add check-gateway=ping distance=2 gateway=192.168.3.1 routing-mark=to_WAN2
add check-gateway=ping distance=3 gateway=192.168.4.1 routing-mark=to_WAN2
add check-gateway=ping distance=1 gateway=192.168.3.1 routing-mark=to_WAN3
add check-gateway=ping distance=2 gateway=192.168.4.1 routing-mark=to_WAN3
add check-gateway=ping distance=3 gateway=192.168.2.1 routing-mark=to_WAN3
add check-gateway=ping distance=1 gateway=192.168.4.1 routing-mark=to_WAN4
add check-gateway=ping distance=2 gateway=192.168.1.1 routing-mark=to_WAN4
add check-gateway=ping distance=3 gateway=192.168.1.1 routing-mark=to_WAN4
add check-gateway=ping distance=1 gateway=192.168.1.1
add check-gateway=ping distance=2 gateway=192.168.2.1
add check-gateway=ping distance=3 gateway=192.168.4.1
add check-gateway=ping distance=3 gateway=192.168.3.1

local a $user;
/queue simple add name=$a target=$address packet-marks=from_web;
/queue simple move [find name=$a] [:pick [find] 0];
/system script run scriptakram;

local a $user;
/queue simple remove [ find name=$a ];
/system script run scriptakram;

/ip hotspot user profile


set [ find default=yes ] on-login=\$user;
"/queue simple add name=\$user target=\$address packet-marks=from_web;\r\
\n/queue simple move [find name=\$user] [:pick [find] 0];\r\
\n/system script run odainew;" on-logout="/queue simple remove [ find name=\
$user ];\r\
\n/system script run odainew;"

/system scheduler
add name=scriptakram on-event=":foreach usersdelete in=[/queue simple find
dynamic=no] do={/queue simple remove \$usersdelete;}" policy=read,write start-
time=startup

{
:local countusers;
:local down 9144000;
:set countusers [ :len [/ip hotspot active find] ];
:if ($countusers=0) do={:set countusers 1;}
:local downuser ($down/$countusers);
:local upuser ($downuser/4);
:foreach usersdelete in=[/queue simple find dynamic=yes (!(queue="hotspot-
default/hotspot-default"))] do={/queue simple remove $usersdelete;}
:local useraddress;
:local username;
:foreach usersactive in=[/ip hotspot active find] do={
:set useraddress [/ip hotspot active get $usersactive address];
:set username [/ip hotspot active get $usersactive user];
/queue simple set [ find name=$username ] max-limit="$upuser/$downuser";
}
}

{
:local i;
:local j 9144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);

:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
/queue simple set [ find name=$uname] max-limit="$y/$x";
}
}

{
:local countusers;
:local down 9144000;
:set countusers [ :len [/ip hotspot active find] ];
:if ($countusers=0) do={:set countusers 1;}
:local downuser ($down/$countusers);
:local upuser ($downuser/4);
:foreach usersdelete in=[/queue simple find dynamic=yes (!(queue="hotspot-
default/hotspot-default"))] do={/queue simple remove $usersdelete;}
:local useraddress;
:local username;
:foreach usersactive in=[/ip hotspot active find] do={
:set useraddress [/ip hotspot active get $usersactive target-addres];
:set username [/ip hotspot active get $usersactive user];
/queue simple set [ find name=$username ] max-limit="$upuser/$downuser";
}
}

{
:local i;
:local j 8144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/3);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];

/queue simple add name=$uname target=$addr packet-marks=from_odai


max-limit="$y/$x";

}
}
/queue simple set [ find name=nab2017] max-limit=45k/256k;

{
:local i;
:local j 8144000;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:local b 200000;
:local a ($x+$b);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
/queue simple add name=$uname target=$addr max-limit="$y/$x"
burst-limit="$upuser/$a" burst-threshold="$upuser/$a" burst-time="4/4" packet-
marks=from_odai ;
}
}

/ip hotspot user profile


set [ find default=yes ] on-login=\
"/queue simple add name=\$user target=\$address;\r\
\n/queue simple move [find name=\$user] [:pick [find] 0];\r\
\n/system script run odai;" on-logout="/queue simple remove [ find name=\
$user ];\r\
\n/system script run odai;"

/system scheduler
add name=odai on-event=":foreach usersdelete in=[/queue simple find dynamic=no]
do={/queue simple remove \$usersdelete;}" policy=read,write start-time=startup

/system script
add name=odai owner=admin policy=read,write source="{\r\
\n:local countusers; \r\
\n:local down 12288000;\r\
\n:set countusers [ :len [/ip hotspot active find] ];\r\
\n:if (\$countusers=0) do={:set countusers 1;}\r\
\n:local downuser (\$down/\$countusers);\r\
\n:local upuser (\$downuser/4);\r\
\n:foreach usersdelete in=[/queue simple find dynamic=yes (!(queue=\"hotspot-
default/hotspot-default\"))] do={/queue simple remove \$usersdelete;}\r\
\n:local useraddress;\r\
\n:local username;\r\
\n:foreach usersactive in=[/ip hotspot active find] do={\r\
\n:set useraddress [/ip hotspot active get \$usersactive address];\r\
\n:set username [/ip hotspot active get \$usersactive user];\r\
\n/queue simple set [ find name=\$username ] max-limit=\"\$upuser/\$downuser\";\r\
\n}\r\
\n}"

rng765765

{
:local i;
:local j 310777216;
:set i [ :len [/ip hotspot active find] ];
:if ($i=0) do={:set i 1;}
:local x ($j/$i);
:local y ($x/4);
:local b 200000;
:local a ($x+$b);
:foreach i in=[/queue simple find] do={/queue simple remove $i;}
:local addr;
:local uname;
:foreach i in=[/ip hotspot active find] do={
:set addr [/ip hotspot active get $i address];
:set uname [/ip hotspot active get $i user];
/queue simple add name=$uname target=$addr max-limit="$y/$x" burst-limit="$y/$a"
burst-threshold="$y/$a" burst-time="4/4" packet-marks=max;
}
}
:local b 100000;
:local a ($x+$b);
burst-limit="$y/$a"

/ip firewall mangle add chain=prerouting action=mark-packet new-packet-


mark=client_up
/ip firewall mangle add chain=prerouting action=mark-packet in-interface=ether1
new-packet-mark=client_download

/ip firewall mangle


add action=mark-packet chain=prerouting in-interface=ether1 new-packet-
mark=client_down passthrough=yes
add action=mark-packet chain=prerouting new-packet-mark=client_up passthrough=yes

/queue tree
add name=speed-down packet-mark=client_download parent=global queue=PCQ_download
add name=speed-up packet-mark=client_upload parent=global queue=PCQ_upload

/queue type
add kind=pcq name=PCQ_download pcq-burst-rate=762666 pcq-burst-time=30s pcq-
classifier=dst-address pcq-rate=562666
add kind=pcq name=PCQ_upload pcq-burst-time=30s pcq-classifier=src-address pcq-
rate=187555

/ip firewall mangle


add action=mark-packet chain=prerouting in-interface=ether1 new-packet-
mark=client_download passthrough=no
add action=mark-packet chain=prerouting new-packet-mark=client_upload
passthrough=yes

{
:local i;

:local c 64144000;

:set i [ :len [/ip hotspot active find] ];

:if ($i=0) do={:set i 1;}


:local x ($c/$i);
:local up ($x/3);

:local y ($x+200000);
/queue type set [find name=PCQ_download] pcq-rate=$x pcq-burst-rate=$y;
/queue type set [find name=PCQ_upload] pcq-rate=$up}
:foreach i in=[/queue simple find where dynamic] do={/queue simple remove $i ;}

You might also like