Mikrotik | Forum Mikrotik Indonesia   Mikrotik Manual Mikrotik iSPY Mikrotik RSS Feed
This Logo is a Courtesy from RumahDowty

Go Back   Mikrotik | Forum Mikrotik Indonesia > Diskusi Mikrotik RouterOS > Scripting @ Mikrotik
iSpy My iTrade Register FAQ Members List Calendar Mark Forums Read

Diskusi [Mohon di koreksi] failover 3isp pada Scripting @ Mikrotik | Mikrotik | Forum Mikrotik Indonesia : para master mikrotik...saya newbie mao minta tolong di periksa ya scriptnya.... Code: /ip route ...




 
Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 23-11-2008, 00:40
Holim Holim is offline
Baru Gabung
 
Join Date: Nov 2008
Posts: 15
iTrader: (0)
Thanks: 2
Thanked 0 Times in 0 Posts
Holim is on a distinguished road
[Mohon di koreksi] failover 3isp




para master mikrotik...saya newbie mao minta tolong di periksa ya scriptnya....
Code:
/ip route add gateway=202.1xx.xxx.xx distance=1 comment=”ISP1”
/ip route add gateway=202.1xx.xxx.xx distance=1 comment=”ISP2”

/ip route add gateway=202.1xx.xxx.xx distance=1 comment=”ISP3”
Code:
/system script add name=”autogateway” source={
:if ([/ip route get [/ip route find  comment="ISP2"] disabled]=yes) do={/ip route enable [/ip route find comment=" ISP2"] /ip route disable [/ip route find comment=" ISP1"]} else={/ip route disable [/ip route find comment=" ISP2"] /ip route enable [/ip route find comment=" ISP1"]}
:if ([/ip route get [/ip route find  comment="ISP3"] disabled]=yes) do={/ip route enable [/ip route find comment=" ISP3"] /ip route disable [/ip route find comment=" ISP2"]} else={/ip route disable [/ip route find comment=" ISP3"] /ip route enable [/ip route find comment=" ISP2"]}
:if ([/ip route get [/ip route find  comment="ISP1"] disabled]=yes) do={/ip route enable [/ip route find comment=" ISP1"] /ip route disable [/ip route find comment=" ISP3"]} else={/ip route disable [/ip route find comment=" ISP1"] /ip route enable [/ip route find comment=" ISP3"]}
}
Code:
/tool netwatch add host=202.1xx.xxx.xx interval=15s timeout=2s up-script=”/ip route enable [find comment=”ISP1”]”

/tool netwatch add host=202.1xx.xxx.xx interval=15s timeout=2s up-script=”/ip route enable [find comment=”ISP2”]”

/tool netwatch add host=202.1xx.xxx.xx interval=15s timeout=2s up-script=”/ip route enable [find comment=”ISP3”]”
yang saya ingin failover begini...jika ada 3isp trus isp1 down maka ke isp2 kalau isp1 udah bener akan balik lagi...sedangkan isp2 down maka ke isp3 kalau isp2 udah bener akan balik lagi..sedangkan isp3 down maka ke isp1 kalau isp3 udah bener akan balik lagi....na kira2 scriptnya bener gak???
saya blom tes soalnya kurang lan cardnya....

jadi urutannya isp1 down ke isp2..isp2 down ke isp3...isp3 down ke isp1..gitu loh...
saya udah baca2 tutor dari forum ini dan mencari2 di google...tapi jarang ada yang 3isp...rata2 2isp....
thread punya kk yosan saya kurang ngerti....
mohon koreksinya.....
terima kasih...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 23-11-2008, 07:53
yosanpro's Avatar
yosanpro yosanpro is offline
VIP Member
 
Join Date: Nov 2007
Location: Bantul, Bantul, Yogyakarta
Posts: 757
iTrader: (1)
Thanks: 23
Thanked 160 Times in 107 Posts
yosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to all
Send a message via Yahoo to yosanpro
Kalo nggak pake Load Balance kenapa nggak pake distance aja? cukup disetting distance=1 pada gateway utama, distance=2 pada gateway kedua, dan seterusnya, trus check-gateway=ping pada semuanya.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 23-11-2008, 11:07
Holim Holim is offline
Baru Gabung
 
Join Date: Nov 2008
Posts: 15
iTrader: (0)
Thanks: 2
Thanked 0 Times in 0 Posts
Holim is on a distinguished road
saya udah memakai load balancing dengan tutor kk kucinggarong dengan mengubah sedikit punya tutor kk kucinggarong..
HTML Code:
http://www.forummikrotik.com/tutorial/239-2-isp-1-router-loadbalancing.html
emang pengaruh ya distancenya kalau saya ubah???bukannya kalau distance itu jarak pemakaian isp gitu??yang saya tangkap kalau distance itu buat jarak antara isp jadi seperti utama yang dipakai dan cadangan blom dipakai tunggu sampai distancenya gitu..

bener tidak???

mohon maaf....kalau salah...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 23-11-2008, 19:15
Akangage's Avatar
Akangage Akangage is online now
Forum Guru
 
Join Date: Aug 2007
Location: Purwokerto
Posts: 1,875
iTrader: (0)
Thanks: 65
Thanked 457 Times in 138 Posts
Akangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura aboutAkangage has a spectacular aura about
Send a message via Yahoo to Akangage
Ngikut aja deh

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 25-11-2008, 13:27
dodolzzzz dodolzzzz is offline
Baru Gabung
 
Join Date: Nov 2008
Posts: 1
iTrader: (0)
Thanks: 0
Thanked 0 Times in 0 Posts
dodolzzzz is on a distinguished road
koq ga pake bonding aja?
lbh gampang kyknya

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 26-11-2008, 03:15
akbar_lana akbar_lana is offline
Baru Gabung
 
Join Date: Aug 2007
Posts: 16
iTrader: (0)
Thanks: 0
Thanked 2 Times in 2 Posts
akbar_lana is on a distinguished road
Send a message via Yahoo to akbar_lana
Thumbs up

Quote:
Originally Posted by Holim View Post
para master mikrotik...saya newbie mao minta tolong di periksa ya scriptnya....
Code:
/ip route add gateway=202.1xx.xxx.xx distance=1 comment=”ISP1”
/ip route add gateway=202.1xx.xxx.xx distance=1 comment=”ISP2”

/ip route add gateway=202.1xx.xxx.xx distance=1 comment=”ISP3”
Code:
/system script add name=”autogateway” source={
:if ([/ip route get [/ip route find  comment="ISP2"] disabled]=yes) do={/ip route enable [/ip route find comment=" ISP2"] /ip route disable [/ip route find comment=" ISP1"]} else={/ip route disable [/ip route find comment=" ISP2"] /ip route enable [/ip route find comment=" ISP1"]}
:if ([/ip route get [/ip route find  comment="ISP3"] disabled]=yes) do={/ip route enable [/ip route find comment=" ISP3"] /ip route disable [/ip route find comment=" ISP2"]} else={/ip route disable [/ip route find comment=" ISP3"] /ip route enable [/ip route find comment=" ISP2"]}
:if ([/ip route get [/ip route find  comment="ISP1"] disabled]=yes) do={/ip route enable [/ip route find comment=" ISP1"] /ip route disable [/ip route find comment=" ISP3"]} else={/ip route disable [/ip route find comment=" ISP1"] /ip route enable [/ip route find comment=" ISP3"]}
}
Code:
/tool netwatch add host=202.1xx.xxx.xx interval=15s timeout=2s up-script=”/ip route enable [find comment=”ISP1”]”

/tool netwatch add host=202.1xx.xxx.xx interval=15s timeout=2s up-script=”/ip route enable [find comment=”ISP2”]”

/tool netwatch add host=202.1xx.xxx.xx interval=15s timeout=2s up-script=”/ip route enable [find comment=”ISP3”]”
yang saya ingin failover begini...jika ada 3isp trus isp1 down maka ke isp2 kalau isp1 udah bener akan balik lagi...sedangkan isp2 down maka ke isp3 kalau isp2 udah bener akan balik lagi..sedangkan isp3 down maka ke isp1 kalau isp3 udah bener akan balik lagi....na kira2 scriptnya bener gak???
saya blom tes soalnya kurang lan cardnya....

jadi urutannya isp1 down ke isp2..isp2 down ke isp3...isp3 down ke isp1..gitu loh...
saya udah baca2 tutor dari forum ini dan mencari2 di google...tapi jarang ada yang 3isp...rata2 2isp....
thread punya kk yosan saya kurang ngerti....
mohon koreksinya.....
terima kasih...
mungkin bisa menggunakan cara ECMP failover
mungkin sedikit contoh dari gw tentang failover 3 ISP

Ip Route
Code:
/ip route add gateway=202.1xx.xxx comment="ISP1"
/ip route add gateway=202.2xx.xxx comment="ISP2"
/ip route add gateway=202.3xx.xxx comment="ISP3"
System Scripts
Code:
/system script add name=Failover source={
:if ([/ping 202.1xx.xxx count=1]=1) do={
	/ip route enable [find comment="ISP1"]
	/ip route disable [find comment="ISP2"]
	/ip route disable [find comment="ISP3"]
} else={
	:if ([/ping 202.2xx.xxx count=1]=1) do={
		/ip route disable [find comment="ISP1"]
		/ip route enable [find comment="ISP2"]
		/ip route disable [find comment="ISP3"]
	} else={
		:if ([/ping 202.3.xx.xxx count=1]=1) do={
			/ip route disable [find comment="ISP1"]
			/ip route disable [find comment="ISP2"]
			/ip route enable [find comment="ISP3"]
		} else={
			/ip route enable [find comment="ISP1"]
			/ip route disable [find comment="ISP2"]
			/ip route disable [find comment="ISP3"]
		}
	}
}
}
System Scheduler
Code:
/system scheduler add name="Failover" interval="10s" on-event="/system script run Failover"
Bisa di coba script di atas...automatic backup 10 detik jika ada gateway yg mati dgn catatan priority berdasarkan ISP1 -> ISP2 -> ISP3 dan balik lagi ke ISP1 jika ISP3 (ISP prioritas terakhir) ternyata down.

mungkin mohon dikoreksi juga klo2 ada yg salah...


Last edited by akbar_lana : 28-11-2008 at 23:48.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to akbar_lana For This Useful Post:
  #7 (permalink)  
Old 26-11-2008, 08:57
Holim Holim is offline
Baru Gabung
 
Join Date: Nov 2008
Posts: 15
iTrader: (0)
Thanks: 2
Thanked 0 Times in 0 Posts
Holim is on a distinguished road
Quote:
Originally Posted by akbar_lana View Post
mungkin bisa menggunakan cara ECMP failover
mungkin sedikit contoh dari gw tentang failover 3 ISP

Ip Route
Code:
/ip route add gateway=202.1xx.xxx comment="ISP1"
/ip route add gateway=202.2xx.xxx comment="ISP2"
/ip route add gateway=202.3xx.xxx comment="ISP3"
System Scripts
Code:
/system script add name=Failover source={
:if ([/ping 202.1xx.xxx count=1]=1) do={
	/ip route enable [find comment="ISP1"]
	/ip route disable [find comment="ISP2"]
	/ip route disable [find comment="ISP3"]
} else={
	:if ([/ping 202.2xx.xxx count=1]=1) do={
		/ip route disable [find comment="ISP1"]
		/ip route enable [find comment="ISP2"]
		/ip route disable [find comment="ISP3"]
	} else={
		:if ([/ping 202.3.xx.xxx count=1]=1) do={
			/ip route disable [find comment="ISP1"]
			/ip route disable [find comment="ISP2"]
			/ip route enable [find comment="ISP3"]
		} else={
			/ip route enable [find comment="ISP1"]
			/ip route disable [find comment="ISP2"]
			/ip route disable [find comment="ISP3"]
		}
	}
}
}
System Scheduler
Code:
/system scheduler add name="Failover" interval="10s" on-event="/system script run Failover"
Bisa di coba script di atas...automatic backup 10 detik jika ada gateway yg mati dgn catatan priority berdasarkan ISP1 -> ISP2 -> ISP3 dan balik lagi ke ISP1 jika ISP3 (ISP prioritas terakhir) ternyata down.

mungkin mohon dikoreksi juga klo2 ada yg salah...
wow...terima kasih kk akbar....entar saya akan coba dl.....karena mesti beli LAN card dl....

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 26-11-2008, 13:18
yosanpro's Avatar
yosanpro yosanpro is offline
VIP Member
 
Join Date: Nov 2007
Location: Bantul, Bantul, Yogyakarta
Posts: 757
iTrader: (1)
Thanks: 23
Thanked 160 Times in 107 Posts
yosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to allyosanpro is a name known to all
Send a message via Yahoo to yosanpro
Ini mah ampir mirip ama pemakaian distance...

Coba aja dibikin ip routenya gini:

/ip route add gateway=a.a.a.a check-gateway=ping distance=1
/ip route add gateway=b.b.b.b check-gateway=ping distance=2
/ip route add gateway=c.c.c.c check-gateway=ping distance=3

kalo gateway a.a.a.a lancar, otomatis kedua gateway lainnya tidak dipakai dan berwarna biru, tetapi kalau gateway a.a.a.a ping timeout, maka dia akan beralih ke gateway b.b.b.b dan yang a.a.a.a menjadi biru (tidak digunakan). Demikian juga kalo a dan b timeout maka yang aktif menjadi gateway c. Namun bila gateway a konek kembali, maka secara otomatis dia akan kembali ke gateway a...

Pemakaian distance dan check-gateway dapat juga digunakan sebagai failover di Load Balance, dengan konsekuensi rasio kurang imbang.

Anyway, semuanya kembali ke selera dan kemantapan pemakai...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to yosanpro For This Useful Post:
  #9 (permalink)  
Old 26-11-2008, 13:44
adeldian adeldian is offline
Member Senior
 
Join Date: Nov 2007
Posts: 377
iTrader: (2)
Thanks: 1
Thanked 82 Times in 58 Posts
adeldian has a spectacular aura aboutadeldian has a spectacular aura aboutadeldian has a spectacular aura aboutadeldian has a spectacular aura aboutadeldian has a spectacular aura about
Send a message via Yahoo to adeldian
yup bnr kata bung yosa
pakai distance sj dengan check gateway by ping
maka otomatis akan aktif si gateway lainnya yang lebih kecil distancenya jika distance terkecil lebih rendah

tetapi jika untuk kasus loadbalancing berbeda lagi
routenya tambaha banyak hehehehe
/ip route add gateway=a.a.a.a check-gateway=ping distance=1
/ip route add gateway=b.b.b.b check-gateway=ping distance=2
/ip route add gateway=c.c.c.c check-gateway=ping distance=3
/ip route add gateway=a.a.a.a routing-mark=mark1 check-gateway=ping distance=1
/ip route add gateway=b.b.b.b routing-mark=mark1 check-gateway=ping distance=2
/ip route add gateway=c.c.c.c routing-mark=mark1 check-gateway=ping distance=3
/ip route add gateway=a.a.a.a routing-mark=mark2 check-gateway=ping distance=3
/ip route add gateway=b.b.b.b routing-mark=mark2 check-gateway=ping distance=1
/ip route add gateway=c.c.c.c routing-mark=mark2 check-gateway=ping distance=2
/ip route add gateway=a.a.a.a routing-mark=mark3 check-gateway=ping distance=2
/ip route add gateway=b.b.b.b routing-mark=mark3 check-gateway=ping distance=3
/ip route add gateway=c.c.c.c routing-mark=mark3 check-gateway=ping distance=1

maka yang pertama kali aktif dengan kondisi diping bisa jika tidak bisa maka routing dengan mark yang tidak aktf akan mencari distance yg lbh rendah bgt strsnya

tanpa script schedule malah lebih cepat ini responsenya
saya sudah mencoba dengan LB 2 line dan hsilnya bagus.

*aku ada pertanyaan,
1. jika pakai fitur check-gateway=ping apakah bisa kita menggunakan pada model jaringan spt ini:
modem (PPPoE)----MT---- Client, soalnya kan modem hidup trs?
2. jika model bridge, tetapi gatewaynya sama misal pakai 2 speedy bgmnkah cara mengetahui line ini mati apa tidak?

semoga membantu
terima kasih


Last edited by adeldian : 26-11-2008 at 13:51.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 26-11-2008, 22:37
Holim Holim is offline
Baru Gabung
 
Join Date: Nov 2008
Posts: 15
iTrader: (0)
Thanks: 2
Thanked 0 Times in 0 Posts
Holim is on a distinguished road
Quote:
Originally Posted by yosanpro View Post
Ini mah ampir mirip ama pemakaian distance...

Coba aja dibikin ip routenya gini:

/ip route add gateway=a.a.a.a check-gateway=ping distance=1
/ip route add gateway=b.b.b.b check-gateway=ping distance=2
/ip route add gateway=c.c.c.c check-gateway=ping distance=3

kalo gateway a.a.a.a lancar, otomatis kedua gateway lainnya tidak dipakai dan berwarna biru, tetapi kalau gateway a.a.a.a ping timeout, maka dia akan beralih ke gateway b.b.b.b dan yang a.a.a.a menjadi biru (tidak digunakan). Demikian juga kalo a dan b timeout maka yang aktif menjadi gateway c. Namun bila gateway a konek kembali, maka secara otomatis dia akan kembali ke gateway a...

Pemakaian distance dan check-gateway dapat juga digunakan sebagai failover di Load Balance, dengan konsekuensi rasio kurang imbang.

Anyway, semuanya kembali ke selera dan kemantapan pemakai...
tapi dalam kasus ini.....semua isp lagi digunakan...jadi jika isp A sedang down maka akan pindah ke isp B walaupun traffic isp B lagi lumayan penuh trafficnya..intinya akan failover walaupun harus jadi penuh trafficnya...

jadi isp B ama C bukan sebagai cadangan gitu...kalo memakai distance saya udah pernah coba waktu 2isp....1 utama dan 1 cadangan...jadi kalau utama down maka akan pindah kecadangan..kalo udah benar maka cadangan tidak dipakai lagi...itu sudah berhasil...na scripts untuk failover 2isp saya ganti menjadi 3isp..dan hasilnya seperti post pertama saya gitu.....tapi saya masih ragu dan belum mencobanya....

kira2 yang dipost ama kk akbar, ada yang udah coba kah???

Oh iya, saya memakai mikrotik vers 3.10


Last edited by Holim : 26-11-2008 at 23:00.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 28-11-2008, 18:07
akbar_lana akbar_lana is offline
Baru Gabung
 
Join Date: Aug 2007
Posts: 16
iTrader: (0)
Thanks: 0
Thanked 2 Times in 2 Posts
akbar_lana is on a distinguished road
Send a message via Yahoo to akbar_lana
Quote:
Originally Posted by Holim View Post
tapi dalam kasus ini.....semua isp lagi digunakan...jadi jika isp A sedang down maka akan pindah ke isp B walaupun traffic isp B lagi lumayan penuh trafficnya..intinya akan failover walaupun harus jadi penuh trafficnya...

jadi isp B ama C bukan sebagai cadangan gitu...kalo memakai distance saya udah pernah coba waktu 2isp....1 utama dan 1 cadangan...jadi kalau utama down maka akan pindah kecadangan..kalo udah benar maka cadangan tidak dipakai lagi...itu sudah berhasil...na scripts untuk failover 2isp saya ganti menjadi 3isp..dan hasilnya seperti post pertama saya gitu.....tapi saya masih ragu dan belum mencobanya....

kira2 yang dipost ama kk akbar, ada yang udah coba kah???

Oh iya, saya memakai mikrotik vers 3.10
Dicoba aja dulu...soalnya sy disini sudah terapin di warnet2/ client2 yg sampe saat ini sy manage networknya...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to akbar_lana For This Useful Post:
  #12 (permalink)  
Old 29-11-2008, 00:03
Holim Holim is offline
Baru Gabung
 
Join Date: Nov 2008
Posts: 15
iTrader: (0)
Thanks: 2
Thanked 0 Times in 0 Posts
Holim is on a distinguished road
Quote:
Originally Posted by akbar_lana View Post
Dicoba aja dulu...soalnya sy disini sudah terapin di warnet2/ client2 yg sampe saat ini sy manage networknya...
wah,sial deh...masa motherboardnya cuman ada pci slot 2 doank.....maklum masih yang lama....padahal udah beli Lan card...

saya sich sudah agak mengerti dari scriptnya kk akbar....
ternyata dibuat if bersarang...huehuehuehue.....mantap oi logikanya...saya aja tidak berpikir sampe segitu.....entar coba di VMware dl ah...

terima kasih ya kk akbar dan semua yang ada di forum ini...terima kasih....

kalau masih ada yang bingung, entar saya akan tanya lagi.....

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 03-12-2008, 01:49
Holim Holim is offline
Baru Gabung
 
Join Date: Nov 2008
Posts: 15
iTrader: (0)
Thanks: 2
Thanked 0 Times in 0 Posts
Holim is on a distinguished road
Quote:
Originally Posted by akbar_lana View Post
mungkin bisa menggunakan cara ECMP failover
mungkin sedikit contoh dari gw tentang failover 3 ISP

Ip Route
Code:
/ip route add gateway=202.1xx.xxx comment="ISP1"
/ip route add gateway=202.2xx.xxx comment="ISP2"
/ip route add gateway=202.3xx.xxx comment="ISP3"
System Scripts
Code:
/system script add name=Failover source={
:if ([/ping 202.1xx.xxx count=1]=1) do={
	/ip route enable [find comment="ISP1"]
	/ip route disable [find comment="ISP2"]
	/ip route disable [find comment="ISP3"]
} else={
	:if ([/ping 202.2xx.xxx count=1]=1) do={
		/ip route disable [find comment="ISP1"]
		/ip route enable [find comment="ISP2"]
		/ip route disable [find comment="ISP3"]
	} else={
		:if ([/ping 202.3.xx.xxx count=1]=1) do={
			/ip route disable [find comment="ISP1"]
			/ip route disable [find comment="ISP2"]
			/ip route enable [find comment="ISP3"]
		} else={
			/ip route enabl