Community discussions

MikroTik App
 
engineertote
Member Candidate
Member Candidate
Topic Author
Posts: 177
Joined: Tue May 19, 2009 1:36 pm

PPP Active connection + simple queue Script

Sun May 13, 2012 12:39 pm

Hi All

i'm trying to write script to add simple queue for each active user in PPP active with no success till now , the target is :

i have 4 service levels each level have difrent up / down limit and the required sicript is to add new simple queue once the client be active on PPP active .

Any help is highly appreciated .


Thanks
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: PPP Active connection + simple queue Script

Sun May 13, 2012 7:15 pm

try this script
foreach pppuser in=[/ppp active find ] do={
local ip [/ppp active get $pppuser address ]
local name [/ppp active get $pppuser name]
foreach queue in=[/queue simple find] do={
local tmp [/queue simple get $queue target-addresses]
if ($ip!=$tmp) do={queue simple add name=$name target-addresses=$ip max-limit=256k/512k
}}}
change max-limit (upload/download)
 
User avatar
acim
Member
Member
Posts: 415
Joined: Mon Sep 12, 2005 12:26 am
Location: Serbia
Contact:

Re: PPP Active connection + simple queue Script

Mon May 14, 2012 3:22 am

You can use RADIUS server or UserManager to reply with bandwidth limit attributes.
 
engineertote
Member Candidate
Member Candidate
Topic Author
Posts: 177
Joined: Tue May 19, 2009 1:36 pm

Re: PPP Active connection + simple queue Script

Mon May 14, 2012 3:10 pm

i tried it but its didn't add any simple queue when the ppp user logged in as active user

try this script
foreach pppuser in=[/ppp active find ] do={
local ip [/ppp active get $pppuser address ]
local name [/ppp active get $pppuser name]
foreach queue in=[/queue simple find] do={
local tmp [/queue simple get $queue target-addresses]
if ($ip!=$tmp) do={queue simple add name=$name target-addresses=$ip max-limit=256k/512k
}}}
change max-limit (upload/download)
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: PPP Active connection + simple queue Script

Mon May 14, 2012 9:52 pm

what version is runing in your routerboard??

paste in the terminal and read the output


I tested in 5.15 and work fine
 
engineertote
Member Candidate
Member Candidate
Topic Author
Posts: 177
Joined: Tue May 19, 2009 1:36 pm

Re: PPP Active connection + simple queue Script

Mon May 14, 2012 11:55 pm

i tried 5.12 and 5.16 ,, i believe that there is no difference ..

when u test it is is totall same just copy and past into the script and run the script ??

what version is runing in your routerboard??

paste in the terminal and read the output


I tested in 5.15 and work fine
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: PPP Active connection + simple queue Script

Tue May 15, 2012 5:49 am

copy and paste in the terminal.
 
engineertote
Member Candidate
Member Candidate
Topic Author
Posts: 177
Joined: Tue May 19, 2009 1:36 pm

Re: PPP Active connection + simple queue Script

Wed Oct 17, 2012 4:07 am

do we need to modify the lines in red ,,bellow code

local ip [/ppp active get $pppuser address ]
local tmp [/queue simple get $queue target-addresses]
if ($ip!=$tmp) do={queue simple add name=$name target-addresses=$ip max-limit=256k/512k
try this script
foreach pppuser in=[/ppp active find ] do={
local ip [/ppp active get [color=#FF0000]$pppuser address[/color] ]
local name [/ppp active get $pppuser name]
foreach queue in=[/queue simple find] do={
local tmp [/queue simple get [color=#FF0000]$queue target-addresses[/color]]
if ($ip!=$tmp) do={queue simple add name=[color=#FF0000]$name[/color] target-addresses=[color=#FF0000]$ip[/color] max-limit=256k/512k
}}}
change max-limit (upload/download)
 
engineertote
Member Candidate
Member Candidate
Topic Author
Posts: 177
Joined: Tue May 19, 2009 1:36 pm

Re: PPP Active connection + simple queue Script

Thu Feb 14, 2013 1:32 am

its work for me , but if i have diffident service level , any idea how to create script for each service level ?

try this script
foreach pppuser in=[/ppp active find ] do={
local ip [/ppp active get $pppuser address ]
local name [/ppp active get $pppuser name]
foreach queue in=[/queue simple find] do={
local tmp [/queue simple get $queue target-addresses]
if ($ip!=$tmp) do={queue simple add name=$name target-addresses=$ip max-limit=256k/512k
}}}
change max-limit (upload/download)

Who is online

Users browsing this forum: No registered users and 9 guests