Community discussions

 
User avatar
karo84
Member Candidate
Member Candidate
Topic Author
Posts: 194
Joined: Fri Aug 17, 2007 9:06 am

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

Tue Aug 21, 2007 2:43 pm

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
 
User avatar
balimore
Forum Veteran
Forum Veteran
Posts: 892
Joined: Mon Apr 10, 2006 3:38 am

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

Wed Aug 22, 2007 3:46 am

----
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
 
User avatar
karo84
Member Candidate
Member Candidate
Topic Author
Posts: 194
Joined: Fri Aug 17, 2007 9:06 am

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

Wed Aug 22, 2007 12:28 pm

/ 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
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5942
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

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

Wed Aug 22, 2007 1:11 pm

: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] ;
                } 
            }
        }
    }
}
 
User avatar
karo84
Member Candidate
Member Candidate
Topic Author
Posts: 194
Joined: Fri Aug 17, 2007 9:06 am

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

Wed Aug 22, 2007 10:15 pm

Thanks I am very glad to know that I'll solve my problem. :!:
I am thankfull for help.
 
User avatar
karo84
Member Candidate
Member Candidate
Topic Author
Posts: 194
Joined: Fri Aug 17, 2007 9:06 am

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

Thu Aug 23, 2007 2:54 pm

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 ?

Who is online

Users browsing this forum: No registered users and 11 guests