Page 1 of 1

How To Limit PPTP users' download rate using script ??

Posted: Tue Aug 21, 2007 2:43 pm
by karo84
I need to limit my PPTP users, but I want to do that using scripts. When a user's download rate is > 1M, I want to limit that speed by scripting. Look at my example. Here I need to give the interface name or IP address who has almost 1M tx-rate. How can I solve these problems?

 /system script add source={/interface monitor-traffic [/interface find type=pptp-in ] once do={:if ($received-bits-per-second > 10485760) do {/
queue simple add max-limit=262144/262144 interface=[/interface find  }



Thanks

Karo

Re: How To Limit PPTP users' download rate using script ??

Posted: Wed Aug 22, 2007 3:46 am
by balimore
----
hai fren
yes, we have scenario after login in, we will reach interface name and modify speed, visit this link at second script one here: http://forum.mikrotik.com/viewtopic.php?f=9&t=17102

regards
Hasbullah.com
----
I need to limit my PPTP users, but I want to do that using scripts. When a user's download rate is > 1M, I want to limit that speed by scripting. Look at my example. Here I need to give the interface name or IP address who has almost 1M tx-rate. How can I solve these problems?

 /system script add source={/interface monitor-traffic [/interface find type=pptp-in ] once do={:if ($received-bits-per-second > 10485760) do {/
queue simple add max-limit=262144/262144 interface=[/interface find  }



Thanks

Karo

Re: How To Limit PPTP users' download rate using script ??

Posted: Wed Aug 22, 2007 12:28 pm
by karo84
/ system script
add name="script1" source="/interface monitor-traffic \[/interface find type=pptp-in \] once do {:if \(\$received-bits-per-second > 512000\) do {/queue simple \
add max-limit=262144/262144 target-address=(Must be variable or something else in order to limit by src-address, I mean I want too make QOS using script, I want to make script run and find pptp users whose download rate is > 512000 and limit them adding simple queues)}}" policy=ftp,reboot,read,write,policy,test,winbox,password




Help me please I am not programmer and I don't uderstand the scripts very well

I'll be very Thankfuul

Re: How To Limit PPTP users' download rate using script ??

Posted: Wed Aug 22, 2007 1:11 pm
by mrz
:foreach i in=[/interface find] do={
    /interface monitor-traffic $i once do={
        :if ($"received-bits-per-second" > 512000 ) do={
            :local tmpIP [/ip address get [/ip address find interface=$i] address] ;
            :log warning $tmpIP ;
            :for j from=( [:len $tmpIP] - 1) to=0 do={
                :if ( [:pick $tmpIP $j] = "/") do={
                    /queue simple add name=$i max-limit=256000/256000 dst-address=[:pick $tmpIP 0 $j] ;
                } 
            }
        }
    }
}

Re: How To Limit PPTP users' download rate using script ??

Posted: Wed Aug 22, 2007 10:15 pm
by karo84
Thanks I am very glad to know that I'll solve my problem. :!:
I am thankfull for help.

Re: How To Limit PPTP users' download rate using script ??

Posted: Thu Aug 23, 2007 2:54 pm
by karo84
Hi everyone
So I have written some scripts for Limiting PPTP users bandwith, but sometimes I am having problems, when the script works (In System>Script menu I see that it had been run) it doesn't change any value or something like that. But when I make script to work manualy, it works very well,

WHY???
Who can explain me ?