Sharing Mikrotik Sederhana

Bandwidth sharing between shared user in hotspot
For example if you have a profile and applied shared user to it (let's say 3) and fix the rate to 512k/512k as in pic1, in normal situation when these shared user logged in each one gets the full rate as in pic2, here is a script to share the total bandwidth between them instead of getting the full bandwidth, in the profile u wanna to share the bandwidth between active users put this script in script on-login tab:
{
:delay 2
:local l [:len [/ip hotspot active find user="$username"]]
# Enter the download and upload speed in kbps in the next two lines
:local up 256
:local down 512
:set up ($up*1024)
:set down ($down*1024)
:if ($l>1) do={
/queue simple remove [find ((dynamic=yes)&&(limit-at="0/0"))]
:set up ($up/$l)
:set down ($down/$l)
:foreach i in=[/ip hotspot active find user="$username"] do={
:local a [/ip hotspot active get value-name=address $i]
:set a ("$a"."/32")
/queue simple remove [find target=$a]
/queue simple add target=$a limit-at="$up/$down" max-limit="$up/$down" name="$user,$l"
:set l ($l-1)
}}}
and in the script on-logout
{
:delay 2
:local l [:len [/ip hotspot active find user="$username"]]
# Enter the download and upload speed in kbps in the next two lines
:local up 256
:local down 512
:set up ($up*1024)
:set down ($down*1024)
:if ($l>0) do={
:set up ($up/$l)
:set down ($down/$l)
:foreach i in=[/ip hotspot active find user="$username"] do={
:local a [/ip hotspot active get value-name=address $i]
:set a ("$a"."/32")
queue simple set max-limit="$up/$down" limit-at="$up/$down" [find target=$a]
}}
:delay 2
local qq ("$address"."/32")
queue simple remove [find target="$qq"]
}
i applied this script to profile with rate of 256k/512k as shown in pic3
now testing the result in pic4 ....






Posting Komentar

- Gunakan kata-kata yang baik, sopan dan santun
- Komentar yang berbau SARA, Pornografi, Pelecehan dan Kekerasan dilarang keras
- Dilarang Anonymous dan SPAM! Berkomentarlah yang berkualitas

[blogger]

MKRdezign

Formulir Kontak

Nama

Email *

Pesan *

Diberdayakan oleh Blogger.
Javascript DisablePlease Enable Javascript To See All Widget