Pada tutorial kali ini saya akan membuat voucher hotspot di Mikrotik dengan sistem FUP mirip seperti sistem FUP di Indihome dengan menggunakan scrip pada Mikrotik, contohnya:

  • Paket : 5Mbps
  • Kecepatan Awal : 5Mbps
  • Batas FUP 1 : > 1GB (Diatas 1GB)
  • Kecepatan Setelah FUP 1 : 4Mbps
  • Batas FUP 2 : > 1,5Gb (Diatas 1,5GB)
  • Kecepatan Setelah FUP 2 : 2Mbps

Langkah-langkah

Konsepnya kita akan membuat 3 user profiles sebagai berikut:

  • 5mb : untuk kecepatan upload 512k dan download 5Mbps
  • fup1 : untuk kecepatan upload 512k dan download 4Mbps
  • fup2 : untuk kecepatan upload 512k dan download 2Mbps

Jadi kecepatan awal sebelum kena fup user hotspot/voucher diberi kecepatan Up/Downoad 512k/5M, ketika user hotspot/voucher melewati pemakaian internet/fup1 sebesar 1Gb maka voucher tersebut akan logout otomatis dan kecepatan akan turun menjadi Up/Download 512k/4M, kemudian setelah pemakaian internet/fup melewati 1,5Gb maka kecepatan akan turun menjadi Up/Download 512k/2Mbps dan voucher tersebut otomatis logout.

Buat User Profile

Buat User Profile kira-kira seperti pada gambar dibawah ini

Buat Scheduler

Buat schedule dengan script dibawah ini, script ini akan memeriksa secara berkala bytes-in+bytes-out apabila melebihi fup maka user/voucher akan otomatis diganti menjadi fup1 dan fup2 sesuai dengan pemakaian internet.

Ubah trafLimit sesuai kuota yang diinginkan, konversi dulu byte-KB-MB dan GB, misalnya untuk 1GB=1024MB dan 1KB=1024bytes. Maka untuk 1 GB=1024 x 1024 x 1024.

Share to Unlock Contentimage/svg+xml

Silahkan share untuk membuka link download dan membuka scriptnya

Apabila tutorial ini bermanfaat support saya dengan cara share artikel ini.. Terimakasih 

:foreach i in=[/ip hotspot active find]  do={
/ip hotspot active remove $i
}
/ip hotspot user {
    :local limitedProfile "5m"
    :local limitedSlowProfile "fup1"
    :local trafLimit 1073741824

    :local userList [find profile=$limitedProfile]
    :foreach user in=$userList do={
        :local traf ([get $user bytes-in] + [get $user bytes-out])
        :put ("User (" . [get $user name] . ") traf: " . $traf)
        :if ($traf > $trafLimit) do={
            set $user profile=$limitedSlowProfile
            :put ("User (" . [get $user name] . ") reached the traf limit")
            :log warning ("User (" . [get $user name] . ") reached the traf limit")
        }
    }
}
 /ip hotspot user {
    :local limitedProfile "fup1"
    :local limitedSlowProfile "fup2"
    :local trafLimit 1610612736

    :local userList [find profile=$limitedProfile]
    :foreach user in=$userList do={
        :local traf ([get $user bytes-in] + [get $user bytes-out])
        :put ("User (" . [get $user name] . ") traf: " . $traf)
        :if ($traf > $trafLimit) do={
            set $user profile=$limitedSlowProfile
            :put ("User (" . [get $user name] . ") reached the traf limit")
            :log warning ("User (" . [get $user name] . ") reached the traf limit")
        }
    }
}

Pengujian

Belum saya coba..hehe
nanti saya bikin videonya saja

Baca juga:

Sumber : Forum Mikrotik

10 COMMENTS

  1. setelah saya terapkan. user yang belum kena fup kena tendang/logout juga.
    adakah script untuk membuat fup usermanager?
    saya terpikir untuk membuat fup usermanager dengan mengganti di bagian limitations -> constrain -> group name
    lebih jelasnya screenshoot -> https://ibb.co/X4NNvNN

  2. kalau pakai cara itu tidak efektif. misal seharusnya buat voucher 1 jam expired jadi 2 jam.
    karena yang 1 jam masih ada kuota yang 1 jam sudah fup.

    yang ampuh sih cuma mengganti profile limitation group name. cuma saya sudah berbulan-bulan belum ada yang share sama sekali terkait fup usermanager.

  3. kalau yg begini apakah bisa ?

    {
    # Variables:
    :local limitedProfile “Paket-Harian”
    :local limitedSlowProfile “FUP”
    :local trafLimit 800000000

    # Code:
    :local uList [/ip hotspot user find profile=$limitedProfile]
    :foreach u in=$uList do={
    :local traf ([/ip hotspot user get $u bytes-in] + [/ip hotspot user get $u bytes-out])
    :local uActive [/ip hotspot active find user=[/ip hotspot user get $u name]]
    :if ([:len $uActive] != 0) do={
    :set traf ($traf + [/ip hotspot active get $uActive bytes-in] + [/ip hotspot active get $uActive bytes-out])
    }

    :put (“User (” . [/ip hotspot user get $u name] . “) traf: ” . $traf)
    :if ($traf > $trafLimit) do={
    /ip hotspot user set $u profile=$limitedSlowProfile
    :put (“User (” . [/ip hotspot user get $u name] . “) mencapai batas FUP yg ditentukan”)
    :if ([:len $uActive] != 0) do={
    /queue simple set max-limit=256k/256k [find name=[/ip hotspot user get $u name]]
    #/ip hotspot active remove $uActive #Hapus tanda pagar jika anda ingin User yg active dikeluarkan dari jaringan
    :put (“User (” . [/ip hotspot user get $u name] . “) kecepatannya akan diturunkan”)
    }
    :log warning (“User (” . [/ip hotspot user get $u name] . “) sudah melebihi batas FUP”)
    }
    }
    }

Leave a ReplyCancel reply