Sebelumnya mohon maaf kepada rekan forum kalau cara yg ingin saya bagi di sini terbilang basi atau perneh ditemuin dari situs lain. karena memang script ini saya lihat dari situs lain. tapi saya lupa nama situsnya, yg pasti dari situs luar sepertinya.
Ok kita mulai saja.
Tidak sedikit kita memerlukan ip addres yg mungkin kita perlukan untuk blocking, priority ataupun untuk burstable. berikut saya ingin memberikan contoh script yg digunakan untuk trap ip video dan facebook berdasarkan domain dan dari dns cache. untuk trap nya menggunakan scheduler. sehingga berkala.
Code:
/system scheduler
add comment="" disabled=yes interval=15m name=add-video on-event=":foreach i i\
n=[/ip dns cache find] do={\r\
\n :local bNew \"true\";\r\
\n :local cacheName [/ip dns cache all get \$i name] ;\r\
\n# :put \$cacheName;\r\
\n\r\
\n :if (([:find \$cacheName \"vimeo\"] != 0) || ([:find \$cacheName \"w\
rzuta\"] != 0) || ([:find \$cacheName \"edgesuite\"] != 0) || ([:find \$ca\
cheName \"googlevideo\"] != 0) || ([:find \$cacheName \"nba.com\"] != 0) |\
| ([:find \$cacheName \"dailymotion\"] != 0) || ([:find \$cacheName \"xtub\
e\"] != 0) || ([:find \$cacheName \"redtube\"] != 0) || ([:find \$cacheNam\
e \"youtube\"] != 0) || ([:find \$cacheName \"tube8\"] != 0) || ([:find \$\
cacheName \"pornhub\"] != 0) || ([:find \$cacheName \"youporn\"] != 0) || \
([:find \$cacheName \"youjizz\"] != 0) || ([:find \$cacheName \"metacafe\"\
] != 0) || ([:find \$cacheName \"porn99\"] != 0)) do={\r\
\n\r\
\n :local tmpAddress [/ip dns cache get \$i address] ;\r\
\n#\t:put \$tmpAddress;\r\
\n\r\
\n# if address list is empty do not check\r\
\n :if ( [/ip firewall address-list find ] = \"\") do={\r\
\n :log info (\"added entry: \$[/ip dns cache get \$i name] IP \
\$tmpAddress\");\r\
\n /ip firewall address-list add address=\$tmpAddress list=yout\
ube comment=\$cacheName;\r\
\n /ip firewall address-list add address=\$tmpAddress list=not-\
youtube comment=\$cacheName;\r\
\n } else={\r\
\n :foreach j in=[/ip firewall address-list find ] do={\r\
\n :if ( [/ip firewall address-list get \$j address] = \$tm\
pAddress ) do={\r\
\n :set bNew \"false\";\r\
\n }\r\
\n }\r\
\n :if ( \$bNew = \"true\" ) do={\r\
\n :log info (\"added entry: \$[/ip dns cache get \$i name]\
\_IP \$tmpAddress\");\r\
\n /ip firewall address-list add address=\$tmpAddress list=\
youtube comment=\$cacheName;\r\
\n /ip firewall address-list add address=\$tmpAddress list=\
not-youtube comment=\$cacheName;\r\
\n }\r\
\n }\r\
\n }\r\
\n}\r\
\n" policy=reboot,read,write,policy,test,password,sniff,sensitive \
start-date=jan/01/1970 start-time=00:00:00
add comment=facebook disabled=yes interval=15m name=add-facebook on-event=":forea\
ch i in=[/ip dns cache find] do={\r\
\n :local bNew \"true\";\r\
\n :local cacheName [/ip dns cache all get \$i name] ;\r\
\n# :put \$cacheName;\r\
\n\r\
\n :if (([:find \$cacheName \"facebook.com\"] != 0)) do={\r\
\n\r\
\n :local tmpAddress [/ip dns cache get \$i address] ;\r\
\n#\t:put \$tmpAddress;\r\
\n\r\
\n# if address list is empty do not check\r\
\n :if ( [/ip firewall address-list find ] = \"\") do={\r\
\n :log info (\"added entry: \$[/ip dns cache get \$i name] IP \
\$tmpAddress\");\r\
\n /ip firewall address-list add address=\$tmpAddress list=face\
book comment=\$cacheName;\r\
\n } else={\r\
\n :foreach j in=[/ip firewall address-list find ] do={\r\
\n :if ( [/ip firewall address-list get \$j address] = \$tm\
pAddress ) do={\r\
\n :set bNew \"false\";\r\
\n }\r\
\n }\r\
\n :if ( \$bNew = \"true\" ) do={\r\
\n :log info (\"added entry: \$[/ip dns cache get \$i name]\
\_IP \$tmpAddress\");\r\
\n /ip firewall address-list add address=\$tmpAddress list=\
facebook comment=\$cacheName;\r\
\n }\r\
\n }\r\
\n }\r\
\n}\r\
\n" policy=reboot,read,write,policy,test,password,sniff,sensitive \
start-date=jan/01/1970 start-time=00:00:00
dari address list yg terbuat bila di gabung dengan conbyte dan priority saya rasa rekan semuanya dapat membayangkannya kan?
sedangkan selain itu ya dapat anda gunakan juga untuk yg lain. tergantung imajinasi anda.
dan bila ada yg mengatakan bila dibandingkan dengan L7 untuk trapnya bagai mana maka silahkan di coba sendiri
untuk facebook sebaiknya ditambahkan FBCDN juga
kredit hanya untuk forum.