Quota Bandwidth User Manager Hotspot Mikrotik & Voucher Design


Firstly I do apologize to the respectable agratitudesign visitors, I personally still learn and research  to find the solution in the case that I have found that’s all would like to write into the blog as a record of my research and lesson.  I'm sure there some of you still disappointed about less of my response, I really sorry about it, many questions that sometimes makes me a bit stuck. Think about the concept, to resolve the problem, which is very likely different situations, but I thank you, that the questions of you sometimes as an inspiration to me.

I come back to continue with the discussion about building hotspot server on mikrotik. In order to manage the bandwidth hotspot system, as probably you know mikrotik  router has the extension packages that is called “User Manager”. User Manager allow you to make “Authentication, Authorization dan Accounting Server” on the mikrotik router. As the AAA server that has database system, you can fully manage the clients in the case is called “users” and the bandwidth management, you can even set the quota limit based on the packages.


1. Install NTP &User Manager Packages of the All Packages Router

First you have to go to http://www.mikrotik.com/download and you can download the full packages router, it’s depending on what the routerboard series that you have and the router OS that you use. So choose the compatible packages of your router. In this case I have RB750 using Router OS vesion 6.

 

As you can see, you have the full packages of the router system, ntp and user manager packages also has included therein.  Now we ready to install ntp and user manager packages that we require by putting the packages to router files, if you are using winbox go to files on the winbox main menu and put the files there, or you can you winscp application to put the files and reboot the router. If it still not clear, see the video!

2. Setup Parent Time Zone and Radius Hotspot Mikrotik Router

After we have installed ntp and user manager package to our router system, make the parent time zone is always in updated state. User manager will depending on the time setting on the router system to manage the database packages and clients/users. Just through new terminal console winbox, and paste this rule!

?
1
2
/system ntp client
set enabled=yes mode=unicast primary-ntp=152.118.24.8 secondary-ntp=202.169.224.16

 

You will see the configuration on NTP client that using NTP servers. Next you click on System > Clockyou will setup the clock router system for the parent time zone of your router, it is depending to your time area.

User manager has the database system that will require to setup the radius configuration to your router. just paste the rules below to the terminal console winbox to make the radius configuration automatically on your router.

?
1
2
3
/ip hotspot profile set hsprof1 use-radius=yes
 
/radius add service=hotspot address=127.0.0.1 secret=123456

 

3. Setup the Customer & Router of the User Manager

Here is a bit confusing about differences in customer and admin for each routerOS, to avoid that, I conclude personally that Customer is one of the administrator of user manager that will be able to generate and manage the hotspot users/client. Each customers will have different users, that means users is under the rule of customer. For more simple just paste this rules to make the customer and router account of the database user manager and configuration.

?
1
2
3
4
/tool user-manager customer
add login=agratitudesign password="password" permissions=owner currency=Rupiah
/tool user-manager router
add name=router customer=agratitudesign ip-address=127.0.0.1 shared-secret=123456
 
You can see the result by typing “ip_public_interface_router/userman” such 192.168.137.2/userman on the browser as the pictures above!

4. Setup the Users Variables of the User Manager Customer

Setting Users Variables,  here we do manually by clicking on Settings > Appearance on the user manager interface and choose the variables that want to use to the visible variables box and click save!

The visible data variables that used are

Username
Password
Start Time
End Time
Total Time Left
Till Time
Uptime Used
Uptime Limit
Money Paid

5. Create User Account Packages of the User Manager

We start by creating the user manager profiles, rather than doing it manually, I personally prefer to make use of script rules below. I just need to set the value of the profiles configuration, This will speed up our works rather than creating manually. But keep in mind that this rules use owner=agratitudesign is related to the customer as the owner. If already finished to set the value, just paste this code through console terminal winbox.

?
1
2
3
4
5
6
/tool user-manager profile
add name="256K Hourly" name-for-users=5hours price=10000 starts-at=logon validity=2d owner=agratitudesign
add name="512K Daily" name-for-users=1day price=20000 starts-at=logon validity=1d owner=agratitudesign
add name="512K weekly" name-for-users=7day price=50000 starts-at=logon validity=7d owner=agratitudesign
add name="768K Mothly" name-for-users=1month price=120000 starts-at=logon validity=4w2d owner=agratitudesign
add name="1M Annual Unlimited" name-for-users=1year price=1000000 starts-at=logon validity=365d owner=agratitudesign

You can see the result on the profiles user manager like the picture below! Imagine if you want to make many profiles. If you made manually huh... so tired, clack click and write in somewhere, sometimes confused our self, does it not?

Associated with the user manager profiles, next we create the profile limitations as the packages of the users hotspot. Just do the same thing as we created user manager profiles, we will write the script rules that we need to set the values as your plan and paste it to the console terminal winbox.

1GB = 1024 x 1024 x 1024 = 1073741824B
2GB = 2 x 1024 x 1024 x 1024 = 2147483648B
500MB = 5 x 1024 x 1024 = 524288000B
For the example if you want to plan the quota limit for your users member with package 1GB you have to insert the value 1073741824B that equal to 1GB of download-limit. Next we will require to set rate-limit-min-rx & tx, and rate-limit-rx & tx. As the state when the quota limit has been reached. If the user member has reached the quota limit value, the bandwidth speed will be reduced to the rate-limit-min. Ok give you the note below!

download-limit : quota limit download
upload-limit : quota limit upload
transfer-limit : quota limit download+upload
rate-limit-tx : speed limit download (if the quota has not been reached)
rate-limit-rx : speed limit upload (if the quota has not been reached)
rate-limit-min-tx : speed limit download (if the quota has been reached)
rate-limit-min-rx : speed limit upload (if the quota has been reached)
download-limit=0B : unlimited quota download
rate-limit-tx=262144B : speed limit download 256 kbps
So you must understand the configuration value to make the right plan to the user manager hotspot packages as you like. After you have setup the value of this rules you just paste the code to the console terminal winbox.

?
1
2
3
4
5
6
7
8
9
10
11
/tool user-manager profile limitation
add name="256k Hourly" download-limit=524288000B upload-limit=0B transfer-limit=0B uptime-limit=5h owner=agratitudesign \
rate-limit-min-rx=65536B rate-limit-min-tx=65536B rate-limit-rx=131072B rate-limit-tx=262144B
add name="512k Daily" download-limit=1073741824B upload-limit=0B transfer-limit=0B uptime-limit=1d owner=agratitudesign \
rate-limit-min-rx=131072B rate-limit-min-tx=131072B rate-limit-rx=262144B rate-limit-tx=524288B
add name="512k weekly" download-limit=2147483648B upload-limit=0B transfer-limit=0B uptime-limit=1w owner=agratitudesign \
rate-limit-min-rx=131072B rate-limit-min-tx=131072B rate-limit-rx=262144B rate-limit-tx=524288B
add name="768K Monthly" download-limit=7516192768B upload-limit=0B transfer-limit=0B uptime-limit=4w2d owner=agratitudesign \
rate-limit-min-rx=196608B rate-limit-min-tx=196608B rate-limit-rx=524288B rate-limit-tx=786432B
add name="1M Annual Unlimited" download-limit=0B upload-limit=0B transfer-limit=0B uptime-limit=365d owner=agratitudesign \
rate-limit-min-rx=262144B rate-limit-min-tx=262144B rate-limit-rx=524288B rate-limit-tx=1048576B
We have just created 5 user manager profiles and the profile limitations, next step is adding the the limitation to the profiles itself. The limitation names is related to the profile names. Go to the profilesmenu of the user manager. On the profiles tab, you have any profile list and click add new limitation > select the limitation name > add > activate > save profiles. Look at the picture for more details.

Do this step to all profiles list that you have to add the limitation profiles that is associated with.

6. Generate Users Account for Each Packages of User Manager Profiles

We can create the user member of the hotspot packages with the strong security username and password that will generated automatically how much you want. The account member that will generated is impossible to be remembered.
As you can see on the picture above, to generate the user account member, you can click on users > add > batch, on the user details window you can set the number of users and select assign profilesof  the profiles that we have just created. Finally you will get the user account members, you can do like this for each profiles as the hotspot packages that you have.

7. Create the Voucher Style of User Accounts Hotspot Packages

After create the user account for all profile packages, the next step is to create the style of the voucher hotspot member. Go to the Setting of the user manager menu, go to templates tab and select VoucherStyle as shown like the picture below!


Here you can see the HTML script code to create voucher style, you can create a new voucher style by clicking + button. But I just overwrite this voucher style so that is the HTML code for the header and rowthat I overwrite is according to this HTML Voucher Scripts that is still not minified yet for you can customize!

The HTML Code for Header

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
    <title>Vouchers</title>
    <style>
        @media print {
            .noprint {
                display: none;
            }
            .pagebreak {
                page-break-after: always;
            }
        }
        body {
            font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
            padding: 50px 100px;
            font-size: 13px;
        }
        div.box {
   background-color: #46A700;
   background-image: linear-gradient(to bottom, #95D814, #46A700);
   background-repeat: repeat-x;
            width: 3.6in;
            height: 2.1in;
            padding: 0 17px 18px 12px;
            margin: 10px 0;
            border: solid 1px #D9D9D9;
            border-radius: 10px;
            -webkit-border-radius: 2px;
            -moz-border-radius: 2px;
        }
        div.box h2 {
   background-color: #153E5D;
   border-color: #2B78C5;
            margin: 0 -17px 1px -12px;
            padding: 15px 0px 0 10px;
            height: 20px;
            border-top-left-radius: 10px;
            border-top-right-radius: 10px;
            -webkit-border-radius: 2px;
            -moz-border-radius: 2px;
            font: bold 18px/0.2 Arial;
            color: #fff;
            text-align: center;
        }
        div.box h3 {
            background-color: #FFF8DC;
            border-color: #000;
            border-style: solid;
            border-width: 1px;
            margin: -35px 0 0 70px;
            padding: 12px 50px 3px 10px;
            height: 8px;
            width: 30px;
            font: bold 12px/0 Arial;
            color: #000;
        }
        div.box h4 {
   background-color: #153E5D;
   border-color: #2B78C5;
            /* IE6-9 */          
            margin: 0 -17px 1px -12px;
            padding: 15px 0px 0 10px;
            height: 20px;
            border-bottom-left-radius: 10px;
            border-bottom-right-radius: 10px;
            -webkit-border-radius: 2px;
            -moz-border-radius: 2px;
            font: bold 12px/0.2 Arial;
            text-align: center;
            color: #fff;
 
        }
        .block-left {
            background-color: transparent;
            width: 170px;
            height: 120px;
            margin: 15px 0;
            float: left;
        
        .block-right {
            background-color: transparent;
            width: 150px;
   float: right;
   padding: 0px 5px 15px !important;
            text-align: center;
        }
 
        .block-right > h5 {
   font: bold 25px/0.1 Arial;
   text-align: center;
   color: #FFF;
   text-shadow: 2px 2px 2px #000;
   margin: 25px 0;
        }     
  .block-bottom {
            background-color: transparent;
            clear: both;
        }
        .txtbox img {
            width: 50px;
            height: 50px;
            float: left;
            padding-right: 5px;
        }    
    </style>
</head>
<body>

The HTML Code for Row

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<div class="box">
    <h2>Agratitudesign-Hotspot Rp. %u_moneyPaid%</h2>
    <div class="block-left">       
     <div class="txtbox">
            <img alt="" src="/umfiles/agratitudesignlogo.png"/><b>Agratitudesign HighSpeed Hotspot</b>       
     </div>
        <div class="txtbox2">
            <p>Open your browser, put the <b>UserName</b> and <b>Password</b> in required field, then <b>click login button.</b></p>
        </div>
    </div>
 
    <div class="block-right">
     <h5>%u_timeLeft%</h5>
     <p>Price: <b>Rp. %u_moneyPaid%</b></p>
     <div><p align="left">UserName:</p><h3 align="center">%u_username%</h3></div>
     <div><p align="left">Password:</p><h3 align="center">%u_password%</h3></div>
    </div>
    <div class="block-bottom">
     <h4>Contact for more info. agratitudesign.blogspot.com</h4>
    </div>
</div>

If you want to create the voucher style with the logo as the image extension files, we have to create the new folder/directory umfiles on the first path of the router files.  And the html code to call this image file will be like this.

<img alt="" src="/umfiles/agratitudesignlogo.png"/><b>Agratitudesign HighSpeed Hotspot</b> 

Quota Bandwidth User Manager Hotspot Mikrotik & Voucher Design

The last you can check the voucher style to display the user account member of the hotspot package. Back to the users menu, put the check mark on top user account if you want create all of the user accounts that you have, click generate and select voucher. Next you can download the user accounts with the voucher style and you have ready to print the voucher package member of your hotspot. 

 

If you are using the image for the voucher style, the download doesn’t include the image files, to do that you need to generate the voucher without download as file and view on the browser.  From the browser you can download the complete style of the voucher hotspot and finally you can print the voucher hotspot account member. So that is all, if it is less clear for you, see the video! Good luck!

Comments

Popular posts from this blog

DMASOFTLAB RADIUS MANAGER BILLING SYSTEM v 4.1 Finally Released

How To Configure Nano Station M2 As Access point