Pada artikel ini saya akan membahas bagaimana cara membuat load balancing mikrotik 2 isp mode pcc & failover mikrotik 2 isp tidak mengalami lag pada saat salah satu dari moedem isp tidak dapat terkoneksi ke internet.

Silahkan teman teman pastekan script di bawah ini ke dalam mikrotik teman teman pada menu System -> Script

adsbygoogle || []).push({});
:local ip1 ("Gateway ISP1")
:local ip2 ("Gateway ISP2")
:local ping1
:local ping2
:local U ("UP")
:local D ("DOWN")
:global ISP1;
:global ISP2;
:global MSG;
:set ping1 [/ping $ip1 count=2]
:if ($ping1 = 0) do={
	:set ISP1 "DOWN";
	:put $ISP1;
} else={
	:set ISP1 "UP";
	:put $ISP1;
}

:set ping2 [/ping $ip2 count=2]
:if ($ping2 = 0) do={
	:set ISP2 "DOWN";
	:put $ISP2;
} else={
	:set ISP2 "UP";
	:put $ISP2;
}
:if ($ISP1 = $ISP2) do={ 
	:if ($ISP1 = $U) do={ 
		:set MSG $U;
		:if (([:len [/ip route find where comment="ISP1" and disabled]] > 0)) do={
			/ip route { enable [find comment="ISP1"]};
		}	
		:if (([:len [/ip route find where comment="ISP2" and disabled]] > 0)) do={
			/ip route { enable [find comment="ISP2"]};
		}
		:if (([:len [/ip route find where comment="Main" and disabled]] > 0)) do={
			/ip route { enable [find comment="Main"]};
		}			
		:log info ("1.ISP1 & 2 = $MSG");

	} else={
		:set MSG $D;:log warning ("1.ISP1 & 2 = $MSG");
	}

} else={
	:if ($ISP1 = $U) do={
		:set MSG "ISP1 = $U & ISP2 = $D";
		:if (([:len [/ip route find where comment="ISP1" and disabled]] > 0)) do={
			/ip route { enable [find comment="ISP1"]};
		}
		:if (([:len [/ip route find where comment="ISP2" and !disabled]] > 0)) do={
			/ip route { disable [find comment="ISP2"]};
		}
			/ip route { disable [find comment="Main"]};
		:log warning ("2. $MSG");
	} else={
		:if (([:len [/ip route find where comment="ISP1" and !disabled]] > 0)) do={
			/ip route { disable [find comment="ISP1"]};
		}
		:if (([:len [/ip route find where comment="ISP2" and disabled]] > 0)) do={
			/ip route { enable [find comment="ISP2"]};
		}
			/ip route { disable [find comment="Main"]};
		:set MSG "ISP1 = $D & ISP2 = $U";
		:log warning ("2. $MSG");
	}
		
}

Artikel yang Direkomendasikan

Tinggalkan Balasan

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

Open chat
hii Selamat Datang Di Menara Tower !!!