Contoh SCRIPT-SCRIPT MIKROTIK

beberapa script mikrotik & fungsi’nya :


Mengirimkan pesan log ke mikrotik :

/log info message=mikrotik UP;
atau 
:log info "111";

Restart mikrotik :

/system reboot;

menampilkan informasi tertentu di log 
 :log info ("Halo Admin, konfig berhasil");
 :log info ("----------------->>>> Halo Admin, konfig berhasil<<<<-----------------");

delay / nunggu script jalan lagi
:delay 10000ms; #untuk menunggu 10detik
:delay 60000ms; #untuk menunggu 60detik
:delay 180000ms; #untuk menunggu 3menit


contoh script unt menyalakan & mematikan Netwatch, interval 1jam,


Contoh Script “pemilihan”

/ip route set [/ip route find where dst-address=0.0.0.0/0] disabled=yes
/ip route set [/ip route find where dst-address=0.0.0.0/0 distance=6] disabled=yes
/ip route set [/ip route find where dst-address=0.0.0.0/0 di
stance=4 gateway=192.168.6.2] disabled=yes
/ip route set [/ip route find where gateway=8.8.4.4] distance=2
/ip route set [/ip route find where gateway=8.8.8.8] distance=1
/tool netwatch enable numbers=3

Merubah Loop Protection

inter ethernet edit ether2 loop-protect
default / on / off


Scheduler otomatis disable enable interface mikrotik

Contoh scheduler Script men-disable-enable interface sfp, tiap 20menit sekali

Script'nya =
/interface disable sfp1;
/delay 2000ms;
/interface enable sfp1;

:log error "ping 127.0.0.1 berhasil";


/tool netwatch set [/tool netwatch find where host=8.8.8.8] disable=yes;

/tool netwatch set [/tool netwatch find where host=8.8.8.8] disable=no;

:log error "berhasil eksekusi script";
/tool netwatch set [/tool netwatch find where host=192.168.105.1] disable=yes;


/ip route set [/ip route find where gateway=8.8.4.4 dst-address=1.2.3.0/24] distance=3;

/ip route set [/ip route find where gateway=8.8.8.8 dst-address=1.2.3.0/24] distance=1;

/ip route set [/ip route find where gateway=192.168.1.1 dst-address=1.2.3.0/24] distance=2;

:delay 10000ms;



/tool fetch url="https://api.telegram.org/bot176176176:********/sendMessage?chat_id=-100100100100&text=@TitikLokasi, ping 8.8.4.4 gagal, IP Public via ISP 1 (prioritas 1) \E2\93\82 \E2\9E\A1 \E2\9A\A1" keep-result=no;
ISP 1 = 192.168.1.1
ISP 2 = 192.168.2.1
IP Public = 1.2.3.0/24

bot telegram = 176176176
chat_id = 100100100100

nyalakan service telnet 23
/ip service set telnet disable=no


nyalakan security agar telnet hanya bisa diakses dari IP 192.168.1.0/24
/ip firewall filter add action=drop chain=input dst-port=23 protocol=tcp src-address=!192.168.1.0/24

Anda mungkin juga suka...

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *