Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.copy-paste perintah berikut di new terminal mikrotik :
- /system scheduler add interval="00:05:00" name="SHARED-USER-LIMIT"
- 2.copy-paste Script dibawah ini kedalam on-event scheduler "SHARED-USER-LIMIT" :
- ###########################
- # Script By Fajar Rasyadi #
- ###########################
- # limit shared users per-device
- # tanpa harus membuat user-login satu-persatu
- ##############################################
- # totalquotatamb adalah quota yang ingin kita limit /Mb
- :local totalquotamb "200"
- :local totalquota ($totalquotamb * 1024 * 1024)
- :local datadown
- :local dataup
- :local totaldata
- :local macaddress
- ############################################################################
- # user="member" ganti sesuaikan dgn yg ada di users anda tanpa tanda kutip #
- ############################################################################
- :foreach counter in=[/ip hotspot active find user=member] do={
- :set datadown [/ip hotspot active get $counter bytes-out]
- :set dataup [/ip hotspot active get $counter bytes-in]
- :set totaldata ($datadown + $dataup)
- :if ($totaldata>$totalquota) do={
- :set macaddress [/ip hotspot active get $counter mac-address]
- :local inmbdown ($datadown / 1024 / 1024)
- :local inmbup ($dataup / 1024 / 1024)
- :local inmbtotal ($totaldata / 1024 / 1024)
- :log error "ciduk $macaddress"
- :log error "pemakaian down $datadown Bytes / $inmbdown MB"
- :log error "pemakaian up $dataup Bytes / $inmbup MB"
- :log error "pemakaian total $totaldata Bytes / $inmbtotal MB"
- ##################################################################
- # ganti interval untuk seberapa lama kita ingin memblock device #
- ##################################################################
- /sys sch add interval=02:25:00 name=$macaddress on-event="/ip hot ip remove [find mac-address=$macaddress]\r\n/sys sch remove [find name=$macaddress]"
- /ip hotspot ip add mac-address=$macaddress type=blocked comment="DEVICE-LIMIT"
- /ip dhcp-server lease remove [find mac-address=$macaddress]
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement