Anda di halaman 1dari 4

17/05/12

Load Balancing over Multiple Gateways MikroTik Wiki

Load Balancing over Multiple Gateways


ThetypicalsituationwhereyougotonerouterandwanttoconnecttotwoISPs:

Ofcourse,youwanttodoloadbalancing!Thereareseveralwayshowtodoit.Dependingontheparticularsituation,youmay findonebestsuitedforyou.

PolicyRoutingbasedonClientIPAddress
Ifyouhaveanumberofhosts,youmaygroupthembyIPaddresses.Then,dependingonthesourceIPaddress,sendthetraffic outthroughGateway#1or#2.Thisisnotreallythebestapproach,givingyouperfectloadbalancing,butit'seasytoimplement, andgivesyousomecontroltoo. LetusassumeweuseforourworkstationsIPaddressesfromnetwork192.168.100.0/24.TheIPaddressesareassignedas follows: 192.168.100.1127areusedforGroupAworkstations 192.168.100.128253areusedforGroupBworkstations 192.168.100.254isusedfortherouter. AllworkstationshaveIPconfigurationwiththeIPaddressfromtherelevantgroup,theyallhavenetworkmask255.255.255.0, and192.168.100.254isthedefaultgatewayforthem.WewilltalkaboutDNSserverslater. Now,whenwehaveworkstationsdividedintogroups,wecanrefertothemusingsubnetaddressing: GroupAis192.168.100.0/25,i.e.,addresses192.168.100.0127 GroupBis192.168.100.128/25,i.e.,addresses192.168.100.128255
I yud ntudrtn ti,tk teTPI Bsc cus, f o o o nesad hs ae h C/P ais ore o,lo frsm rsucsaotsbetn o teItre! r ok o oe eore bu untig n h nent

WeneedtoaddtwoIPFirewallManglerulestomarkthepacketsoriginatedfromGroupAorGroupBworkstations. ForGroupA,specify ChainpreroutingandSrc.Address192.168.100.0/25 ActionmarkroutingandNewRoutingMarkGroupA.

wiki.mikrotik.com/wiki/Load_Balancing_over_Multiple_Gateways

1/4

17/05/12

Load Balancing over Multiple Gateways MikroTik Wiki

Itisagoodpracticetoaddacommentaswell.Yourmanglerulesmightbeinterestingforsomeoneelseandforyourselfaswell aftersometime. ForGroupB,specify ChainpreroutingandSrc.Address192.168.100.128/25 ActionmarkroutingandNewRoutingMarkGroupB

AllIPtrafficcomingfromworkstationsismarkedwiththeroutingmarksGroupAorGroupB.Wecanusethesemarksinthe wiki.mikrotik.com/wiki/Load_Balancing_over_Multiple_Gateways

2/4

17/05/12

Load Balancing over Multiple Gateways MikroTik Wiki

AllIPtrafficcomingfromworkstationsismarkedwiththeroutingmarksGroupAorGroupB.Wecanusethesemarksinthe routingtable. Next,weshouldspecifytwodefaultroutes(destination0.0.0.0/0)withappropriateroutingmarksandgateways:

Thisthingisnotgoingtowork,unlessyoudomasqueradingforyourLAN!ThesimplestwaytodoitisbyaddingoneNATrulefor Src.Address192.168.100.0/24andActionmasquerade:

TestthesetupbytracingtheroutetosomeIPaddressontheInternet! FromaworkstationofGroupA,itshouldgolikethis:
C\taet- 8888 :>rcr d ... Taigruet 8888oe amxmmo 3 hp rcn ot o ... vr aiu f 0 os 1 2m s 2 1 m 0 s .. . 2m s 4m s 2m s 12181024 9.6.0.5 3m s 1... 0101

wiki.mikrotik.com/wiki/Load_Balancing_over_Multiple_Gateways

3/4

17/05/12

Load Balancing over Multiple Gateways MikroTik Wiki

FromaworkstationofGroupB,itshouldgolikethis:
C\taet- 8888 :>rcr d ... Taigruet 8888oe amxmmo 3 hp rcn ot o ... vr aiu f 0 os 1 2m s 2 1 m 0 s .. . 2m s 4m s 2m s 12181024 9.6.0.5 3m s 1... 0581

YoucanspecifytheDNSserverforworkstationsquitefreely,justmakeitcanbereached(testitbytracingtheroutetoDNS server'sIPaddress)! Category:Routing

wiki.mikrotik.com/wiki/Load_Balancing_over_Multiple_Gateways

4/4

Anda mungkin juga menyukai