Cara Membuat Simple Queue Otomatis
Disini saya akan coba contohin bagaimana membuat simple queue secara otomatis di mikrotik dengan tehnik mengambil IP address dari daftar di “address-list”.Script dibawah ini adalah rule firewall yang menangkap IP address user yang trafik keluar melalui interface WAN/internet. Jadi user yang terhubung dengan internet (karena melewati interface wan) IP address user tersebut akan masuk daftar “address-list” -> user-internet.
1
2
3
4
|
/ip firewall filter
add action=add-src-to-address-list address-list="user-internet" chain=\
forward comment="tangkep user internet" out-interface=\
ether1-gateway
|
Membuat Simple Queue Otomatis
Script dibawah ini digunakan untuk membuat simple queue otomatis di mikrotik pada IP address yang ditemukan di “ip firewall address-list (user-internet)” dan kecepatan dibatasi upload 128Kbps dan download 512Kbps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/system script
add name="automatic-queue [adamonline.web.id]" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive source=":local hostip\r\
\n:local list\r\
\n:local testvalue\r\
\n \r\
\n:log info \"**starting - automatic queue create **\"\r\
\n \r\
\n :foreach i in=[/ip firewall address-list find] do={\r\
\n\r\
\n :set list ([/ip firewall address-list get \$i list] )\r\
\n :set hostip ([/ip firewall address-list get \$i address] )\r\
\n\r\
\n :set testvalue [/queue simple find name=\$hostip]\r\
\n\r\
\n :if ([:len \$testvalue] <= 0) do={\r\
\n :if (\$list = \"user-internet\") do={\r\
\n /queue simple add name=\$hostip comment=\"Automatic Simple Queues [adamonline.web.id]\" target=\$hostip max-limit=128K/512K\r\
\n } else={\r\
\n }\r\
\n } else={\r\
\n \r\
\n }\r\
\n }\r\
\n \r\
\n:log info \"** ending - automatic queue create **\""
|
1
2
3
4
5
|
/system scheduler
add interval=10m name="automatic-queue [adamonline.web.id]" on-event=\
"automatic-queue [adamonline.web.id]" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive start-date=\
nov/23/2014 start-time=15:05:59
|
Tidak ada komentar:
Posting Komentar