Difference between revisions of "Load Balancing over Multiple Gateways"

From MikroTik Wiki
Jump to navigation Jump to search
 
Line 18: Line 18:
We will talk about DNS servers later.
We will talk about DNS servers later.


Next, we need to configure policy routing. We have workstations devided in groups, where we can reffer to them using subnet addresses:
Next, we need to configure policy routing. We have workstations devided into groups, where we can reffer to them using subnet addressing:
* Group A is 192.168.100.0/25
* Group A is 192.168.100.0/25, i.e., addresses 192.168.100.0-127
* Group B is 192.168.100.128/25
* Group B is 192.168.100.128/25, i.e., addresses 192.18.100.128-255


If you do not understand this, take the TCP/IP Basics course!
If you do not understand this, take the TCP/IP Basics course, or, look for some resources about subnetting on the Internet!


We need to add two IP Firewall Mangle rules to mark the packets originated from Group A or B workstations. For Group A, start with specifying Chain '''forward''' and Src. Address '''192.168.100.0/25''':
We need to add two IP Firewall Mangle rules to mark the packets originated from Group A or B workstations.
 
For Group A, start with specifying Chain '''forward''' and Src. Address '''192.168.100.0/25''':


[[Image:dual_gw_20.jpg]]
[[Image:dual_gw_20.jpg]]
Next, specify the Action '''mark routing''' and add New Routing Mark '''groupA'''.
It is a good practice to add a comment as well. Your mangle rules might be interesting for someone else and for yourself as well after some time.

Revision as of 17:26, 21 December 2005

The typical situation where you got one router and want to connect to two ISPs:

<Picture comes here>

Of course, you want to do load balancing. There are several ways how to do it. Depending on the particular situation, you may find one best suited for you.

Policy Routing based on Client IP Address

If you have a number of hosts, you may group them by IP addresses. Then, send the traffic out through Gateway 1 or 2 depending on the source IP address.

Let us assume we use for our workstations IP addresses from network 192.168.100.0/24. The IP addresses are assigned as follows:

  • 192.168.100.1-127 are used for Group A workstations
  • 192.168.100.128-253 are used for Group B workstations
  • 192.168.100.254 is ised for the router.

All workstations have IP configuration with the IP address from the relevant group, they all have network mask 255.255.255.0, and the default gateway 192.168.100.254

We will talk about DNS servers later.

Next, we need to configure policy routing. We have workstations devided into groups, where we can reffer to them using subnet addressing:

  • Group A is 192.168.100.0/25, i.e., addresses 192.168.100.0-127
  • Group B is 192.168.100.128/25, i.e., addresses 192.18.100.128-255

If you do not understand this, take the TCP/IP Basics course, or, look for some resources about subnetting on the Internet!

We need to add two IP Firewall Mangle rules to mark the packets originated from Group A or B workstations.

For Group A, start with specifying Chain forward and Src. Address 192.168.100.0/25:

Dual gw 20.jpg

Next, specify the Action mark routing and add New Routing Mark groupA.


It is a good practice to add a comment as well. Your mangle rules might be interesting for someone else and for yourself as well after some time.