Advertisement
kajege

nganu

Apr 22nd, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #add parent
  2. :if ([:len ([/queue simple find name=total])] <1 do="{<br">/queue simple add target-addresses="192.168.10.0/24" max-limit=2M/2M interface=all priority=7 name="total-bw"
  3. }
  4.  
  5. #import ip yang ada di ARP list
  6. :local ipusers [/ip arp find]
  7. :foreach h in $ipusers do={
  8. :local ipuser [/ip arp get $h address]
  9. :if ([:len $ipuser] >0) do {
  10.  
  11. #ambil ipnya selain ip public
  12. :local ippublic [/ip arp get $h interface]
  13. :if ($ippublic !="eth-public") do {
  14.  
  15. #add diqueue
  16. :if ( [:len ( [/queue simple find name=$ipuser] ) ] <1 br="" do="">:if ([:len ([/queue simple find name=others])]>0) do { /queue simple remove [find name=others] }
  17. /queue simple add target-addresses=$ipuser limit-at=256k/256k max-limit=512k/512k interface=all parent=total priority=7 name=$ipuser
  18. }
  19. }
  20. }
  21. }
  22.  
  23. :if ([:len ([/queue simple find name=others])] <1 br="" do="">/queue simple add target-addresses="192.168.10.0/24" limit-at=256k/256k max-limit=512k/512k interface=all parent=total priority=7 name="others"
  24. }
  25.  
  26. #delete yang tidak aktif
  27. :local ipold [/queue simple find]
  28. :foreach o in $ipold do={
  29. :local iplama [/queue simple get $o name]
  30. :if ([:len $iplama] >0) do {
  31. :if ( $iplama !="total") do={
  32. :if ($iplama !="others") do={
  33. :if ([:len ([/ip arp find address=$iplama])] <1 do="{<br">/queue simple remove [find name=$iplama]
  34. }
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement