ECMP Failover Script

From MikroTik Wiki
Revision as of 15:56, 12 August 2007 by NilCbx (talk | contribs)
Jump to: navigation, search

olympus mini s porno na web perle veneziane duca enrico panche bilanciere www webmotors max sito ufficiale va pensiero nabucco market ingross que es creatividad traduzione della canzone try di nelly fu loredana berte in alto mare sigla buffy scarica ariston frigoriferi monoporta guerra libica 1911 1912 tappetino dance flaibano telefoni filo caraoke romero polsat keys richard stallman colonna sonora gost loire-atlantique sei speciale nerorgasmo nerorgasmo hard disk 2 5 60gb 8mb 5400rpm bottomley, gordon opel vectra 2.0 16v t di 4p. sport cross country merica merica that i would be good ww eamon it tarom telecomando canon eos 300d studio emme la signora e i suoi mariti alyssia west baby got boobs tony d aloia barcellona libri wilkins, sir george hubert toshiba slim mistonocivo acer pro www freindster com c.r.a. angel boris ef 400 is logitech thx sms gratis dal pc finanziamento sevilla casio digital novita pc portatili un sito ufficiale europeo per il nintendo ds punto 5 porte firmware xcam francesca dominatrice un buon inizio 2001 per tdk ekaterinoslav levigare marmo chitarra elettrica custodia peugeot 206 a scoppio pokidat supporto auto pda mitac mio 168 i leoni di pietroburgo dsc t3 sony mini john cooper works lettori audio maglietta nba un grano regno sicilia techno warriors video nokia maschio o femmina commento alle fronde dei salici zooma foto boys logitech cordless desktop lx500 side by general electric si-si srl per vivere insieme meteo verona registratore mini disc portatile www gianni celeste it tv color 14 pollici le cinque equazioni che hanno cambiato rex 22 10 fa stampante laser hp color sigillo cinese solitario pictures www petarde marica giannini g.t.a fotos de xuxa nua immagini di john lennon graduatoria universita uninsubria varese tuscany villa ospedale bollate tcc 8 e dragom ball eleni vitali obiettivi k radeon x850xt platinum crostata marmellata www squadron com lodate speed racer music school thunder tiger uno monitor sony 23 lcd olympus fotocamera digitale mju-mini guerra santa il corano martiri michel vith contatori toyota 4 runner chamotte kaleidoscopia mappa svizzera globet tv monte grappa bic ruga mokia 6680 aspettando la notte accessori passeggino graco joao pessoa hoppner lettori cd lenco volo rozzano gunrun thermaltake shark black spiderman3 canoa kayak sony gb ufficio bussolengo traformare midi in wav wwe giocattoli gigabyte kt600 canon ef 90-300mm f 4 5-5 fornace (trento) speed cross sientelo mp3 farmacie roma pensionata risacca dolce gabbana slip uomo dj ross foto raoul bova clipart scuola ragazzo alghero rio dos elefantes assicurazione autocarro canon dc52 wd scorpio aspire living center tom clacy s win 4d singapore pentax digitale optio 30 film pubblicitari - produzione e realizzazione nuova mini one verde bg sites disco fisso ibero- km0 suzuki gpl auto km 0 eros ramazzotti cuori agitati amico di colore ristorante portico del seminario www calendario anna valle it convocazione oem atx trama di sherlock holmes codici sblocco telefonini via di qua luomo ragno premiato da sony prenotazione hotel canazei m603 bodybuilding video nicoleta lucio impianti chimici www mediawordl bar122hgn oregon testo every body is changing locali noturni mobil phone bobble boom puerto rico hurricane d-link dwl-g mathias porno harry potter home based business opportunity campbell, david perle di ghiaccio dvd ornella vanoni groove com canzoni sarde pistero incontri a fermo hardt, ernst programmi scolastici prove di maturita condizionatore aria ==See also==

How to do automatic ECMP failover


This script demonstrates one method of doing automatic failover using the Netwatch function and using scripting to enable or disable gateways. This is probably not the most efficient way, but it works. I would welcome any input on how it can be improved.

The situation:

You have 2 lines going out to the internet - 10.0.0.12 and 10.0.0.13. You have setup a mangle to mark HTTP traffic (optional) and want to route http along the 2 lines using load balancing.

You setup the mangle:

   /ip firewall mangle add chain=prerouting protocol=tcp dst-port=80 action=mark-routing \
   new-routing-mark=ecmp-http-route passthrough=yes comment=" Route HTTP \
   traffic to ECMP" disabled=no 

You set up ECMP (Equal Cost Multipath Routing) by using something like

   /ip route add dst-address=0.0.0.0/0 gateway=10.0.0.12,10.0.0.13 routing-mark=ecmp-http-route comment="ECMP route for HTTP"

Now you have ECMP for HTTP only. This is nice because MSN messenger, banking websites and other programs and problem sites will not be broken in the same way it might be if you used ECMP for all protocols.

What I then do is for example mark SMTP traffic and route this out through 10.0.0.12:

   /ip firewall mangle add chain=prerouting protocol=tcp dst-port=25 action=mark-routing \
   new-routing-mark=smtp-out passthrough=yes comment="SMTP Traffic" disabled=no 
   /ip route add dst-address=0.0.0.0/0 gateway=10.0.0.12 routing-mark=smtp-out comment="SMTP Traffic out"

and route all other traffic through 10.0.0.13

   /ip route add dst-address=0.0.0.0/0 gateway=10.0.0.13 comment="Default Route to Internet"

Then I need to setup 2 routes to specific addresses to force the router through specific gateways to "test" the links. These should not be popular addresses with your users! Otherwise when a gateway goes down they will have no access to those sites. The addresses I am using as an example are 1.1.1.12 to test 10.0.0.12, and 1.1.1.13 to test 10.0.0.13.

Next I use the Netwatch Function to switch all traffic to the working gateway should any of the gateways fail:

   / tool netwatch 
   add host=1.1.1.13 timeout=2s interval=30s up-script="/ip route set \
   \[find comment=\"Default Route To Internet\"\] gateway=10.0.0.13" \
   down-script="/ip route set \[find comment=\"Default Route To Internet\"\] \
   gateway=10.0.0.12 comment="" disabled=no 
   add host=1.1.1.12 timeout=2s interval=30s up-script="/ip route set \
   \[find comment=\"SMTP Traffic out\"\] gateway=1.0.0.12" down-script="/ip \
   \n" \route set \[find comment=\"SMTP Traffic out\"\] gateway=10.0.0.13
   comment="" disabled=no 

The problem is that the ECMP http route will still be active, therefore http traffic wont work, so I have 2 scripts to check if both gateways are up or down and take action accordingly:

   / system script 
   add name="ecmp-startup" source=":if \(\[/ping 1.1.1.12 count=1\]=1