Syed Jahanzaib Personal Blog to Share Knowledge !

November 20, 2012

Dmasoftlab Radius Manager: Different Bandwidth for Day & Night


Scenario # 1

We have created 512k service for the users, In late night, our bandwidth is usually not much used because only limited number of users uses the internet in late timings. Therefore we want to increase users bandwidth from 512k to 1mb automatically in night 12:00am till 12:00pm

we will divide this article in three sections.

1) Mikrotik Section (For Adding API):
2) Radius Manager Section (For Adding API):
3) Adding Service & Plan in Radius Manager:

Mikrotik Section (For Adding API):

We have to first configure API both in Mikrotik & DMASOFTLAB RM Panel.

Goto IP > Services  & enable API service.
As showed in the image below . . .


Now create API user so it can be used by RM to connect to MT.

Goto SYSTEM  > USERS and add new user by click on + icon.
User name = api
Password = api (or anything else)
As showed in the image below . . .


Radius Manager Section (For Adding API):

Open Radius Manager Admin Panel,
Goto NAS  > LIST NAS
Select your Mikrotik NAS
Click on ENABLE MIKROTIK API
Define API user name & Password that we added in mikrotik section.
As showed in the image below . . .

 

Adding Service & Plan in Radius Manager:

First Create a normal service profile (512k) using Radius Manager Admin Panel.
As showed in the image below . . .


 

Now Click on EDIT button on Special Bandwidth Periods section at the bottom of the page . . .
As showed in the image below . . .


.

Now click on NEW PERIOD
As showed in the image below . . .


Enter your desired timings (in this example I used night 12 till day 12) in which you want to allow excess/reduced bandwidth. After done, click on ADD PERIOD
As showed in the image below . . .


After You see the new Special Bandwidth Periods close this popup window.
As showed in the image below . . .

.


Click on the UPDATE SERVICE  on main service window.

Now create any user and test it by modifying timings (for test or quick results)

As showed in the image below . . .

.


Important Note: [updated as of Year 2016]

DMA 4.1.x change on the fly may not work with ver 6.30 or above. so try this with 6.29 first.


Regard’s
Syed Jahanzaib

Advertisements

DMASOFTLAB RM 4.x Email Notifications for various events

Filed under: Linux Related, Mikrotik Related, Radius Manager — Tags: — Syed Jahanzaib / Pinochio~:) @ 2:30 PM

DMASOFTLAB Radius Manager 4.0.4  have interesting feature of email notifications for various events like account expiry warning, account renewal notification, send custom email to all users, password recovery via email verification code and many more. By default RM uses authentication less smtp server of your ISP, but in most cases Email sent from the RM box arrives in JUNK/SPAM folder in users email box, and sometimes bounces back due to black listed IP’s . This happens very frequent in my country as we widely use national telecom company internet service called PTCL, whose ip’s usually get blocked by many email services. Therefore I created this method by installing SENDMAIL in RM box, and uses my GMAIL account as SENDMAIL SMTP RELAY. This way RM sends mail via localhost, which uses valid GMAIL account to send email and email arrives in users INBOX directly 🙂

First we need to configure sendmail with gmail smtp relay. Use the below link to install.

https://aacable.wordpress.com/2012/12/27/howto-configure-gmail-as-sendmail-relay-d-also-can-be-used-with-rm-to-send-email-notifications/

After you have verified your smtp server is working fine by sending test email to your Hotmail/gmail/yahoo mail account.

You need to edit the following files.

/etc/radiusmanager.cfg
/var/www/radiusmanager/config/system_cfg.php


 

 

Radius Manager 4.0.4 Email Configuration SAMPLES:

 

/etc/radiusmanager.cfg

smtp_relay              localhost                       ; smtp relay
mail_from               GMAILID@gmail.com               ; email sender address
mail_reply              GMAILID@gmail.com               ; email reply adddress
mail_localdomain        127.0.0.1                       ; email local domain

/var/www/radiusmanager/config/system_cfg.php

define("smtp_relay", "localhost");                            // SMTP relay
define("mail_from", "GMAILID@gmail.com");                   // warning email sender
define("mail_reply", "GMAILID@gmail.com");                  // warning email return path
define("mail_preview", "GMAILID@gmail.com");                // preview user of mass mail
define("mail_newuser", "GMAILID@gmail.com");                // self registered new user notification
define("mail_localdomain", "127.0.0.1");                      // default domain name

.

Now Open RM ACP (Administrator Control Panel) ,
Goto SYSTEM > SYSTEM SETTINGS
& check the following settings.
As showed in the image below . . .

5- email setting.

Now Administrator & user will receive various Email Notifications.
As showed in the images below . . .

.

Account Expiry before 5 Days (days are configurable via admin panel / home ,settings)

1- Account Expire Warning

.

.

Welcome Message for newly registered users

2- Welcome New User.

.

Recover Password by Email

3- Recover password by email

.

.

Account Renewed Notification

4- Account Renewed

.

Note: Please check JUNK email folder, because sometimes email gets in JUNK folder if your ISP ips are listed in any dns black list as spam. Mark it safe so future mails comes into INBOX directly.

To edit various Texts appeared in the notifications, you can edit following files.

/var/www/radiusmanager/lang/English/

mailaccrenewfail_tpl.txt
mailnewpsw_tpl.txt
mailwarnexp_tpl.txt
reg_terms.txt
mailforgotpsw_tpl.txt
mailselfreg_tpl.txt
mailwarntraff_tpl.txt
strings.txt
mailaccrenewed_tpl.txt
mailiasreg_tpl.txt
mailsrvchg_tpl.txt
mailwelcomeuser_tpl.txt
texts.txt

/var/www/radiusmanager/
userlogin_tpl.htm

 


 

Radius Manager 4.1.x Email Configuration SAMPLES:

/etc/radiusmanager.cfg


mail_localdomain    127.0.0.1            ; email    local domain

 

/var/www/radiusmanager/config/system_cfg.php


// SMTP definitions

define('smtp_relay', 'localhost');                // SMTP relay
define('smtp_port', 25);                    // SMTP port
define('smtp_auth', FALSE);                    // SMTP authentication
define('smtp_user', 'YOUR_GMAIL_ID@gmail.com');                // SMTP user name
define('smtp_psw', 'YOUR_GMAIL_PASSWORD');                // SMTP password
define('mail_from', 'YOUR_GMAIL_ID@gmail.com');            // sender address
define('mail_fromname', 'SYED JAHANZAIB Support');            // sender name
define('mail_newuser', 'YOUR_GMAIL_ID@gmail.com');            // self registered new user notification
define('mail_localdomain', '127.0.0.1');        // default domain name

 

RENEW


 

Regard’s
Syed Jahanzaib

Dmasoftlab Radius Manager: Quota Base Service

Filed under: Linux Related, Radius Manager — Tags: , , — Syed Jahanzaib / Pinochio~:) @ 2:13 PM

Scenario # 1 =  1 mbps Speed limit, Fix Monthly Quota Base Service with Daily 300 Mb Download Quota limit, if the user cross the daily quota limit, his service will shift to lower speed profile i.e 256k for the current day, after date change, the user profile will revert back to 1mb.

Details:

Bandwidth Allowed = 1 mb
User Expiry = 1 Month
(after one month, user accounts will expire)
User Monthly Traffic Quota = 1 gbps
(after consuming 1gb total, account will expire)
User Daily Traffic Quota = 300mb
(After downloading 300mb in a day, user service will be changed to NEXT DAILY SERVICE of less speed i.e 256k daily service for the rest of the day. after the date change, user service will be returned to normal i.e 1mb)

Ok here we go . . .

First Create New Service in RM using the following screenshots.

.

===========================================================================

Now create another new service using following screenshots.

.

That’s it. Now When the user will be registered using the user.php, he will first see the below account details.

.

After the user refills his account and purchase credit via user panel, his ID will be ACTIVE with the following info.

.

.

After the user reaches above 300 MB in a single day, his service will be switched to NEXT DAILY SERVICE of zaib-256k-daily.


 

NOTE:

5.x:

The Service change will not be implemented on the FLY for pppoe users because COA is not supported for it. only hotspot users service can be changed on the fly. The pppoe session will be auto disconnected by Mikrotik on radius request, and when it will reconnect , the user will be using 256k service profile.

.

6.x: I noted that with version 6.29 , change on the fly works fine for pppoe as well. in few mikrotik versions, this doesnt works as expected. so i recommend to try 6.29.

Regard’s
Syed Jahanzaib

%d bloggers like this: