Anda di halaman 1dari 2

Konfigurasi.

Net

Failover menggunakan script pada MikroTik


March 4, 2018 Author: admin

Hi…

Kali ini kita akan mencoba failover koneksi internet pada mikrotik dengan menggunakan script.
Topologinya kira-kira seperti dibawah, dimana ISP2 sebagai ISP utama dan ISP1 sebagai backup

Saya langsung saja, tidak mulai konfig dari awal ya

Konfig pada IP route

/ip route

add check-gateway=ping comment=ISP2 distance=1 gateway=192.168.2.1

add check-gateway=ping comment=ISP1 distance=1 gateway=192.168.1.1

add comment=netwatch-failover distance=1 dst-address=8.8.8.8/32 gateway=\

192.168.2.1

Kemudian bikin netwatch

/tool netwatch

add down-script=failover-to-ISP1 host=8.8.8.8 interval=3s

add host=8.8.8.8 interval=3s up-script=back-to-ISP2

Setelah itu tambahkan scriptnya

/system script

add name=failover-to-ISP1 owner=admin policy=\

ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\

if ([/ip route get [/ip route find comment=\"ISP2\"] disabled]=yes) do=\

{/ip route enable [/ip route find comment=\"ISP2\"]} else={/ip route di\

sable [/ip route find comment=\"ISP2\"]}"

add name=back-to-ISP2 owner=admin policy=\

ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\

if ([/ip route get [/ip route find comment=\"ISP2\"] disabled]=yes) do=\

{/ip route enable [/ip route find comment=\"ISP2\"]}"

Script diatas bekerja dengan cara membaca “comment” yang diset pada IP Route. Cara kerjanya
adalah, apabila ping ke 8.8.8.8 di ISP2 tidak berjalan atau mati, maka otomatis default route ISP2
akan di disable oleh system, sehingga default route akan beralih ke ISP1. Dan apabila ping ke
8.8.8.8 berjalan kembali di ISP2, maka system akan otomatis men-“enable”-kan default route
ISP2. Perlu diperhatikan dan diingat, comment pada IP route harus sama dengan script

Ok, sekian lab kali ini, terima kasih

Categories:
Uncategorized

Previous: Managing Users and Roles ⇾

⇽ Next: Failover dengan Recursive Gateway pada MikroTik

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.

Post Comment

Search
Search

Recent Posts
Write a Docker File
Ansible Copy Module
Set Limits for Resources in Kubernetes
Write a Docker Compose File
Ansible Config File Update

Recent Comments
No comments to show.

Archives
May 2021
April 2021
March 2021
January 2021
April 2020
March 2020
April 2019
March 2019
January 2019
December 2018
November 2018
October 2018
September 2018
April 2018
March 2018
February 2018

Categories
Uncategorized

Proudly powered by WordPress | Theme: Really Simple by Flaubert Henriques

Anda mungkin juga menyukai