Graphic Motion Video Art, Website, IT Network, Culture

Loading...
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 https://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!

/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 > Clock you 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.

/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.

/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.

/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.

/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 profiles menu 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 profiles of  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 Voucher Style 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 row that I overwrite is according to this HTML Voucher Scripts that is still not minified yet for you can customize!

The HTML Code for Header

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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

<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!

Share This Article :
Related Articles

32 comments :

  1. nice work admin :)

    is it possible hotspot and hotspot user manger is work togehter in one MT router or MT pc base router ????

    ReplyDelete
    Replies
    1. Yes its possible, We have done many of such at https://tnlnetworks.com

      Delete
  2. Good night Ali Gohar ! it looks like you always follow and visit agratitudesign thanks visiting! and I am sorry can not answer all the comments. Sometimes the problems you face does not exactly match with the equipment and environments that I have used. Dhcp server and hotspot server and AAA server (user manager) can be use together with referent rules where the client access the server.

    ReplyDelete
    Replies
    1. Good Day Suardika

      thanks for reply :)
      your blog is very helpfull for me.
      sir when i face some problam you trying to resolve them
      i am bigner in this filed thats way i am facing a lot's of problams

      Delete
  3. Selamat siang Pak Agus

    Can we blok the Guest Hotspot User from acces the private / corporate network? just allow them to access internet only..thanks

    ReplyDelete
    Replies
    1. Maksudnya GUEST user hanya dibenarkan melayari internet sahaja.. GUEST tidak dibenarkan / dihalang melayari sistem organisasi..

      Delete
    2. I guest you can define specific workgroup name as your network organization identity to prevent the access files and system.

      Delete
  4. Total Time Left always blank ????????????????????????

    ReplyDelete
    Replies
    1. I don't understand what actually your problem, have you already setup NTP and clock/time system on router?

      Delete
  5. how can I change the total time left to actual profile in the vouchers ?
    please advise

    ReplyDelete
  6. pak saya lagi belajar bikin hotspot mikrotik, caranya agar link https bisa masuk ke halaman login gimana ya

    ReplyDelete
  7. Hello,
    I am Mohammed Azher Uddin from Star Broadband Services, I am giving Unlimited Packages no FUP so can I put Burst Limit in my packages for an example if I give 3 Mbps plan my customers reaching upto 4 Mbps, please help me if there is any other solution please give I will follow.

    Crm Software vs Inventum Software which is good for Bandwidth control?

    ReplyDelete
  8. Nice work, i have a doubt, can qr code be implemented?

    ReplyDelete
  9. Bliiii... Mau nanya nih, Kalau untuk Menampilkan Sisa waktu yang digunakan User di Status.html gimana ya ???

    Thank Bli...

    ReplyDelete
  10. radius accounting request not sent no response
    routerboard CCR1009-8G-1S-1S+

    ReplyDelete
  11. Hello !
    Thank you for this excellent work. However I have two short questions
    1. Is it possible that the quota and rate consider only traffics passing through the wan interface?
    2. Otherwise how to make exchanges in my intranet not be included in the quota and traffic-rate limitations (Or just how not to limit the traffic-rate with my local servers)

    ReplyDelete
  12. Halo bli.. artikel nya luar biasa keren, komplit banget. Oya, saya juga penggiat Mikrotik dan tinggal di Bali juga, tepatnya di Kapal, Mengwi. Kali aja bisa sharing2, hehe.
    Oya, saya juga punya blog tentang Mikrotik. Mampir ya :)
    http://mikrotikindo.blogspot.com

    ReplyDelete
  13. Good day Sir, is there a way for me to limit a per day data usage of a client?
    ex. client 1 avails 30days but data limit is 1GB/day for 30 days?
    so all in all after 30days he will only get 30GB of data.

    ReplyDelete
  14. Good day Sir, is there a way for me to limit a per day data usage of a client?
    ex. client 1 avails 30days but data limit is 1GB/day for 30 days?
    so all in all after 30days he will only get 30GB of data.

    ReplyDelete
  15. Thank you ketut, that was perfect explained and demonstrated, thanks again Sir

    ReplyDelete
  16. jam nya kok gak sesuai ya boss,,, gimana car setting nya
    star 12/16/2016 09:18:49
    end 12/17/2016 06:18:49

    seharus nya end 2/17/2016 09:18:49
    jam nya uda di seting => Time zone : +07:00

    ReplyDelete
  17. can u add serial no generator function on recharge card? I have to record how much card has been gone on market for sale on different shop?

    ReplyDelete
  18. Hi all
    can i want to do 1 month plan user is 1 day speed is 3m for 1Gb after 1Gb finish 512k auto change how i do dear all
    please Help me

    ReplyDelete
  19. Pagi p agus, boleh bantu dideskripsikan, kenapa di user manager (userman) setiap saya buat voucher selalu berubah paketnya. Contoh : sy buat paket 1 hari, 1 minggu & 1bulan. Ketika sy klik salah satu paket yg sdh dibuat, maka limit dan harga yg sudah jadi berubah semua, baik yg 1 mgg maupun 1 bulan, berubah menjadi 1 haru. Begitu sebaliknya kalau klik paket yg 1 bulan, maka yg 1 hari & 1mgg nerubah menjadi 1 bulan semua. Mohon bantuan terima kasih atas waktunya.

    ReplyDelete
    Replies
    1. Hah.. apa ya..saya belum pernah menemukan kasus seperti ini, bisa jadi ini bug di userman package. In case just my opinion, try to remove and reinstall the package. atau bila mana perlu upgrade router OS and install userman sesuai versi terakhir ROSnya.

      Delete
  20. izin share karya ane bos
    http://sigernetwork.blogspot.co.id/2016/11/cara-setting-hotspot-system-quota-di-mikrotik.html

    ReplyDelete
  21. Hi Sir, I would like to thank you for all of your tutorials, I made my mikrotik work with the help of your tutorials. In this matter I would Like to ask if you can make a Tutorial about Mikrotik Hotpsot with voucher for those who dont have a userman, like the Mikrotik rb941-2nd-tc hap lite

    ReplyDelete

Back to Top