Community discussions

 
mmshasan
just joined
Topic Author
Posts: 1
Joined: Thu Jan 16, 2014 9:10 am

Day/Night Bandwidth Configure in User Manager

Thu Jan 16, 2014 9:23 am

I'm using PPPoE with MkT User Manager and want to configure time based bandwidth (day/night). Here's what I did....

1. Created a Profile
2. Added two limitation based on time
a) 256k - 00:00:00 - 12:59:59
b) 512k - 13:00:00 - 23:59:59
3. Created an user and associated with above mentioned profile.

But it didn't work out. I had to disconnect and then reconnect the PPPoE to get 512k. Any idea why ?

Please help. Thanks in advance.
You do not have the required permissions to view the files attached to this post.
 
User avatar
rickfrey
Trainer
Trainer
Posts: 610
Joined: Sun Feb 14, 2010 11:41 pm
Location: Van, Texas
Contact:

Re: Day/Night Bandwidth Configure in User Manager

Mon Feb 17, 2014 6:17 am

Because the RADIUS token had already been validated. You might want to try using scheduler to script this process.
Launch your company forward with professional training!
http://rickfreyconsulting.com/product-c ... raining-2/
 
User avatar
aacable
Member
Member
Posts: 422
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: Day/Night Bandwidth Configure in User Manager

Thu Feb 20, 2014 5:34 am

COA messages are not supported by PPPoE at MikroTik RouterOS.
Only DM messages are supported for PPPoE.
(Change on the fly is supported in HOTSPOT however)

You can use following script and schedule it to run two times at 00:00:00 & 13:00:00
It will disconnect all active users and when they will reconnect, they will get new profile speed.
# Print local time for LOG record purposes / tracking
:local CurrentTime [/system clock get time];
:log warning "Script Start to Disconnect all active PPPoE Users for new profile speed at $CurrentTime. . ."
# Disconnect users using find command
/ppp active remove [find service="pppoe"]
:log warning "PPPoE Users disconnection script completed at  $CurrentTime. . ."
You can also use another work around for this purpose.
Create a script that runs at specific time and remove all active queues, and create new queues per ip with new bandwidth allocation, this way you dont have to disconnect users, and still be able to use new bandwidth plan.
Something like ...


OR
create a PCQ base queue and move it on TOP and disable it. now schedule a script that runs at specific timings and enable it, this way it will get preference and will distribute the assigned bandwidth.
_____________
Regard's

Syed Jahanzaib
Web: http://aacable.wordpress.com
Email: aacable [at] hotmail.com
 
User avatar
rickfrey
Trainer
Trainer
Posts: 610
Joined: Sun Feb 14, 2010 11:41 pm
Location: Van, Texas
Contact:

Re: Day/Night Bandwidth Configure in User Manager

Thu Feb 20, 2014 6:18 am

I like that Syed, thanks :D
Launch your company forward with professional training!
http://rickfreyconsulting.com/product-c ... raining-2/
 
User avatar
dunga
Member Candidate
Member Candidate
Posts: 254
Joined: Fri Jan 23, 2009 9:51 am
Location: Nigeria

Re: Day/Night Bandwidth Configure in User Manager

Mon May 26, 2014 3:40 pm

I'm using PPPoE with MkT User Manager and want to configure time based bandwidth (day/night). Here's what I did....

1. Created a Profile
2. Added two limitation based on time
a) 256k - 00:00:00 - 12:59:59
b) 512k - 13:00:00 - 23:59:59
3. Created an user and associated with above mentioned profile.

But it didn't work out. I had to disconnect and then reconnect the PPPoE to get 512k. Any idea why ?

Please help. Thanks in advance.
Any idea on how to set this using hotspot.

I have a similar setup where, i want users/client to use 256k/256k from 7:00am - 12:59am
while 512k/512k from 01:00am - 06:00am.

Using user-manager.

Thanks for your help
 
3l1t3p0is0n
just joined
Posts: 1
Joined: Tue Feb 10, 2015 9:41 pm

Re: Day/Night Bandwidth Configure in User Manager

Tue Feb 24, 2015 9:29 pm

how to give pppoe client on day 128k/384k and night on 128k/512k how can i do it i mean script i'm not using user manager

i mean script and scheduler
 
Aveline
just joined
Posts: 1
Joined: Wed Feb 25, 2015 2:29 pm

Re: Day/Night Bandwidth Configure in User Manager

Fri Feb 27, 2015 5:07 pm

Thanks for support!
 
User avatar
stlony
Frequent Visitor
Frequent Visitor
Posts: 89
Joined: Mon Nov 19, 2007 6:25 pm
Location: Egypt
Contact:

Re: Day/Night Bandwidth Configure in User Manager

Thu Apr 16, 2015 12:50 pm

Hi :)
I was having a problem for such tasks with (PPOE/Hotspot/User manager) but I had created a very useful script to pass this problem. my case was deferent than yours so I will not post my exact script but I will mention the general idea for it.

by executing conditional [IF] command in the script to select whether first order (in Day time) or second order (in Night time) from the script will be run, depending on the current hour.

then changing all the users in the Queues list to the speed 128k/384k if it Day or change them all it to 128k/512k night and run this script every minute for example. this will applied without even disconnecting the users. (applied with dynamic and static queues entries)

by this way you don't need to make two profiles in Usermanger just one speed and the script will complete the job.
 
User avatar
hossain2004a
Member Candidate
Member Candidate
Posts: 247
Joined: Mon Dec 22, 2014 7:34 pm
Location: Iran

Re: Day/Night Bandwidth Configure in User Manager

Mon Apr 20, 2015 5:31 pm

Hi :)
I was having a problem for such tasks with (PPOE/Hotspot/User manager) but I had created a very useful script to pass this problem. my case was deferent than yours so I will not post my exact script but I will mention the general idea for it.

by executing conditional [IF] command in the script to select whether first order (in Day time) or second order (in Night time) from the script will be run, depending on the current hour.

then changing all the users in the Queues list to the speed 128k/384k if it Day or change them all it to 128k/512k night and run this script every minute for example. this will applied without even disconnecting the users. (applied with dynamic and static queues entries)

by this way you don't need to make two profiles in Usermanger just one speed and the script will complete the job.
Can ya share your script??? 8)
 
User avatar
stlony
Frequent Visitor
Frequent Visitor
Posts: 89
Joined: Mon Nov 19, 2007 6:25 pm
Location: Egypt
Contact:

Re: Day/Night Bandwidth Configure in User Manager

Wed Apr 29, 2015 3:53 pm

Hi :)
I was having a problem for such tasks with (PPOE/Hotspot/User manager) but I had created a very useful script to pass this problem. my case was deferent than yours so I will not post my exact script but I will mention the general idea for it.

by executing conditional [IF] command in the script to select whether first order (in Day time) or second order (in Night time) from the script will be run, depending on the current hour.

then changing all the users in the Queues list to the speed 128k/384k if it Day or change them all it to 128k/512k night and run this script every minute for example. this will applied without even disconnecting the users. (applied with dynamic and static queues entries)

by this way you don't need to make two profiles in Usermanger just one speed and the script will complete the job.
Can ya share your script??? 8)

Sure Hossain you welcome

before I post my script here is my case to help anyone understanding what going on this long script :D

- I am working with usermanager broadband I have two profiles there 620kb & 615kb (it is just a names to deferent type of paid users). I give every user comment in his user manger account (like: 620kb@wi-fi.com)
- users connect with me by PPPOE and PPTP (for android users) so the script deals with the two type
- This script put all user queues in one parent queue and gives to every user queues the priority he deserve depending on how many MB he used during each day, starting from 12 AM (all queues are dynamic). (To give them a kind of Fair Using Policy)

for example:
less than 200MB then his queue priority will be 1
from 200MB to 400MB his queue priority will be 2

and so on until he reach to priority 8 his speed will be dropped from 680kb to 400kb

Then it reset the user manager counters and reverse any limited users speed from 400kb to 680kb at 12 AM every day depending on a condition in the script which is "date changed" (and this to always start the reset process even if its time passed while the server is off for any reason)

I schedule run this script every 30 seconds it working perfectly since 4 months as I remember.

Finally here it is.
# Putting All Users Queues in Main Parent
/queue simple
:foreach i in=[find] do={
:if ([/queue simple get $i name] !="Cache-Pass-Fast") do={
:if ([/queue simple get $i name] !="Total_Parent") do={
:if ([/queue simple get $i name] !="hs-<hotspot1>") do={
:if ([/queue simple get $i parent] ="none") do={
/queue simple set $i parent=Total_Parent}
}}}}


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

# Getting 615kb Profile Users Usage During the day
:if ([/tool user-manager user get $i email] ="615kb@wi-fi.com") do={

# Getting Users Less Than 200MB In Day
:if ([/tool user-manager user get $i download-used] <209715200) do={ :set Prior 1/1
:set UserNa [/tool user-manager user get $i name] ;
}

# Getting Users More Than 200MB Less Than 400MB In Day
:if ([/tool user-manager user get $i download-used] >209715200) do={ 
:if ([/tool user-manager user get $i download-used] <419430400) do={ :set Prior 2/2
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 400MB Less Than 600MB In Day
:if ([/tool user-manager user get $i download-used] >419430400) do={ 
:if ([/tool user-manager user get $i download-used] <629145600) do={ :set Prior 3/3
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 600MB Less Than 800MB In Day
:if ([/tool user-manager user get $i download-used] >629145600) do={ 
:if ([/tool user-manager user get $i download-used] <838860800) do={ :set Prior 4/4
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 800MB Less Than 1000MB In Day
:if ([/tool user-manager user get $i download-used] >838860800) do={ 
:if ([/tool user-manager user get $i download-used] <1048576000) do={ :set Prior 5/5
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 1000MB Less Than 1200MB In Day
:if ([/tool user-manager user get $i download-used] >1048576000) do={ 
:if ([/tool user-manager user get $i download-used] <1258291200) do={ :set Prior 6/6
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 1200MB Less Than 1400MB In Day
:if ([/tool user-manager user get $i download-used] >1258291200) do={ 
:if ([/tool user-manager user get $i download-used] <1468006400) do={ :set Prior 7/7
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 1400MB Less Than 1600MB In Day
:if ([/tool user-manager user get $i download-used] >1468006400) do={ 
:if ([/tool user-manager user get $i download-used] <1677721600) do={ :set Prior 8/8
:set UserNa [/tool user-manager user get $i name] ;
}}
}


# Getting 620kb Profile Users Usage During the day
:if ([/tool user-manager user get $i email] ="620kb@wi-fi.com") do={

# Getting Users Less Than 300MB In Day
:if ([/tool user-manager user get $i download-used] <314572800) do={ :set Prior 1/1
:set UserNa [/tool user-manager user get $i name] ;
}

# Getting Users More Than 300MB Less Than 600MB In Day
:if ([/tool user-manager user get $i download-used] >314572800) do={ 
:if ([/tool user-manager user get $i download-used] <629145600) do={ :set Prior 2/2
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 600MB Less Than 900MB In Day
:if ([/tool user-manager user get $i download-used] >629145600) do={ 
:if ([/tool user-manager user get $i download-used] <943718400) do={ :set Prior 3/3
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 900MB Less Than 1200MB In Day
:if ([/tool user-manager user get $i download-used] >943718400) do={ 
:if ([/tool user-manager user get $i download-used] <1258291200) do={ :set Prior 4/4
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 1200MB Less Than 1500MB In Day
:if ([/tool user-manager user get $i download-used] >1258291200) do={ 
:if ([/tool user-manager user get $i download-used] <1572864000) do={ :set Prior 5/5
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 1500MB Less Than 1800MB In Day
:if ([/tool user-manager user get $i download-used] >1572864000) do={ 
:if ([/tool user-manager user get $i download-used] <1887436800) do={ :set Prior 6/6
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 1800MB Less Than 2100MB In Day
:if ([/tool user-manager user get $i download-used] >1887436800) do={ 
:if ([/tool user-manager user get $i download-used] <2202009600) do={ :set Prior 7/7
:set UserNa [/tool user-manager user get $i name] ;
}}

# Getting Users More Than 2100MB Less Than 2400MB In Day
:if ([/tool user-manager user get $i download-used] >2202009600) do={ 
:if ([/tool user-manager user get $i download-used] <2516582400) do={ :set Prior 8/8
:set UserNa [/tool user-manager user get $i name] ;
}}
}


/queue simple
:foreach i in=[find] do={
:global QueueName
:global DelCharc
:global PureName
:global NetName
:set QueueName [/queue simple get $i name]
:set DelCharc [:pick $QueueName 0 7]

# In ppoe Connections Type
:if ($DelCharc ="<pppoe-") do={
:set PureName [:pick $QueueName 7 80]

:if ([:pick $PureName 0 4] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 5] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 6] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 7] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 8] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 9] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 10] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 11] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 12] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 13] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 14] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 15] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 16] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 17] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 18] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 19] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 20] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 21] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
}

# In pptp Connections Type
:set PureName [:pick $QueueName 6 80]

:if ([:pick $PureName 0 4] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 5] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 6] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 7] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 8] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 9] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 10] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 11] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 12] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 13] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 14] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 15] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 16] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 17] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 18] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 19] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 20] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
:if ([:pick $PureName 0 21] = $UserNa) do={ 
:if ([/queue simple get $i priority] != $Prior) do={ /queue simple set $i priority= $Prior}}
}}

# Down Priority 8 users to 400k Speed Limit
/queue simple
:foreach i in=[find] do={
:if ([/queue simple get $i parent] = "Total_Parent") do={
:if ([/queue simple get $i priority] = "8/8") do={ /queue simple set $i limit-at=2M/400k
/queue simple set $i max-limit=2M/400k}}}


# Safe Mode Starting the Resetting Users Counters
:global currentdate
:global saveddate
:set currentdate [/system clock get date]
:set saveddate [/file get RaduisResetLast.txt contents]
:if ($currentdate!=$saveddate) do={
/tool user-manager user
:foreach i in=[find] do={
/tool user-manager user reset-counters $i}

# Reset Limited users speed to normal Speed
/queue simple
:foreach i in=[find] do={
:if ([/queue simple get $i limit-at] = "2M/400k") do={ /queue simple set $i max-limit=2M/680k
/queue simple set $i limit-at=2M/680k}}

# For Resetting Users Counters Starter
:global scriptname
:global lasttimestrarted
:global lastdatestrarted
/system script
:foreach i in=[find] do={
:set scriptname [get $i name]
:if ($scriptname="Fair_Usage_Policy") do={ 
:set lasttimestrarted [get $i last-started]
:set lastdatestrarted [:pick $lasttimestrarted 0 11]
/file set RaduisResetLast.txt content="$lastdatestrarted"}
}
:log info "Users Counters had been reseted"}
to make it easier on the post owner what really help him in his case is this part
/queue simple
:foreach i in=[find] do={
:if ([/queue simple get $i limit-at] = "2M/400k") do={ /queue simple set $i max-limit=2M/680k
/queue simple set $i limit-at=2M/680k}}
This how I can change the speed for users without even disconnect them (while the Queues entries is dynamic too)

If anyone find it helpful don't forget to support this reply as a positive reply

Who is online

Users browsing this forum: No registered users and 3 guests