Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ===============================
- # DHCP Lease Script (Auto Queue)
- # ===============================
- :local queParent "network110"
- :local queueName ("Client-" . $leaseActMAC)
- :local ipAddr ($leaseActIP . "/32")
- # ===============================
- # Hapus Queue jika lease tidak aktif
- # ===============================
- :if ($leaseBound != "1") do={
- :local old [/queue simple find name=$queueName]
- :if ($old != "") do={
- /queue simple remove $old
- :log info ("Queue removed for " . $leaseActMAC)
- }
- :return
- }
- # ===============================
- # Default limit & burst
- # ===============================
- :local maxUp "3M"
- :local maxDown "3M"
- :local burstUp "4M"
- :local burstDown "5M"
- :local burstTime "30s"
- :local burstThresholdUp "2M"
- :local burstThresholdDown "3M"
- # ===============================
- # Custom MAC list (set limit & burst)
- # ===============================
- :if ($leaseActMAC = "F2:CD:FE:C0:81:2C") do={
- # rachma
- :set maxUp "5M"
- :set maxDown "5M"
- :set burstUp "10M"
- :set burstDown "15M"
- :set burstThresholdUp "3M"
- :set burstThresholdDown "4M"
- }
- # ===============================
- # Buat atau Update Queue
- # ===============================
- :local exist [/queue simple find name=$queueName]
- :if ($exist = "") do={
- /queue simple add name=$queueName target=$ipAddr parent=$queParent \
- max-limit=($maxUp . "/" . $maxDown) \
- burst-limit=($burstUp . "/" . $burstDown) \
- burst-threshold=($burstThresholdUp . "/" . $burstThresholdDown) \
- burst-time=($burstTime . "/" . $burstTime)
- :log info ("Queue created for " . $leaseActMAC . " " . $maxUp . "/" . $maxDown . " with burst " . $burstUp . "/" . $burstDown)
- } else={
- /queue simple set $exist target=$ipAddr parent=$queParent \
- max-limit=($maxUp . "/" . $maxDown) \
- burst-limit=($burstUp . "/" . $burstDown) \
- burst-threshold=($burstThresholdUp . "/" . $burstThresholdDown) \
- burst-time=($burstTime . "/" . $burstTime)
- :log info ("Queue updated for " . $leaseActMAC . " " . $maxUp . "/" . $maxDown . " with burst " . $burstUp . "/" . $burstDown)
- }
- # ===============================
- # END OF SCRIPT
- # ===============================
Advertisement