Community discussions

MikroTik App
 
guipoletto
Member Candidate
Member Candidate
Topic Author
Posts: 195
Joined: Mon Sep 19, 2011 5:31 am

Multiple gateways same subnet

Wed Sep 24, 2014 6:32 am

Hi, How can i get a router to multiplex traffic (Natted from wireless interface), to three different gateways in the same network?
Topology is as follows:

GW1........GW2........GW3
x.x.x.X```x.x.x.Y```x.x.x.Z
````|``````|```````|
--------switch---------------------- |(x.x.x.234)rb951 >))) breaks to wifi as 192.168.234.1, and dhcp server.


I want the wifi peers in this router to be load ballanced between different gateways, http and https traffic being gateway fixed, and any other traffic being shared "connection wise" (as in not sorted by each peer IP).

every guide regarding load ballancing i found used a dynamic interface associated to a different ethernet port. I need to join them in this AP only, leaving the rest of the network alone.

Any advice on how can i archieve that?
 
nstorm
just joined
Posts: 14
Joined: Wed Sep 24, 2014 8:05 am

Re: Multiple gateways same subnet

Wed Sep 24, 2014 1:55 pm

Checkout http://wiki.mikrotik.com/wiki/Load_Balancing , especially http://wiki.mikrotik.com/wiki/ECMP_load ... masquerade
You'll never get a real load balancer as like with bonding though. It would be either srcip (i.e. all traffic from one client goes throught one router), or a session based (stateful firewall directing connection through one of the gateways).
 
guipoletto
Member Candidate
Member Candidate
Topic Author
Posts: 195
Joined: Mon Sep 19, 2011 5:31 am

Re: Multiple gateways same subnet

Thu Sep 25, 2014 4:12 am

I have read those , but they only work if i have two different subnet wan's on different physical ports
I have neither. The three gateways are on the same subnet , and get here in the same single cable. Using a second mikrotik to break different sources(src/dst map from/
to ports) to different physical ports sounds like the not ellegant way of doing it. I just can't think of a way to make a masquerade rule that cycles trough different gateways for which new connection (preferrably leaving ports 80 and 443 alone)
Last edited by guipoletto on Thu Sep 25, 2014 3:30 pm, edited 1 time in total.
 
nstorm
just joined
Posts: 14
Joined: Wed Sep 24, 2014 8:05 am

Re: Multiple gateways same subnet

Thu Sep 25, 2014 8:22 am

I don't think having these on the same subnet behind the same port really matters here. You just don't have to setup all the IPs for every subnet and even NAT.
Most important part in ECMP routing is:
/ ip route 
add dst-address=0.0.0.0/0 gateway=10.111.0.1,10.112.0.1 check-gateway=ping 
I.e. it assigns two default gateways and as the manual says it will enable "persistent per-connection load balancing" or "per-src-dst-address combination load balancing".
The masquerade part there is only to NAT outgoing connection, i.e. change their srcip to same subnet as gateway. Like the same you do then you have a signle Internet gateway NATing your local connections to the outside.
I've never did this with Mikrotik, but did the same with Linux routers. It's nearly the same, only takes a few more steps to mark connections to make them per-connection.

Who is online

Users browsing this forum: adwlodaro, intania, jmszuch1 and 57 guests