Bom dia a todos
Testei vários balanceamentos e tive muitos problemas com msn, bancos conectividade social etc
Então pesquisando implementei um load balance por nth + permanent conection e ficou muito bom, aqui estou utilizando 5 links de velocidade iguais e mesma operadora e detalhe os links tem que estar bons pra dar tudo certo no meu caso tenho 2 links locais na sede da empresa e 3 links remotos vindo de outras partes da cidade não entrarei em detalhes esta parte somente o balanceamento mas se alguem tiver duvida é só postar e ajudamos no que puder. Segue:
Comece criando faixas de ip pras interfaces dos links no server mk tenho 7 interfaces lan;
Minha interface que distribui o sinal chama-se clientes.
ip/address list
Link1 = 192.168.4.253/24
Link2 = 192.168.2.253/24
Link3 = 192.168.3.253/24
Link4 = 192.168.1.253/24
Link5 = 192.168.9.253/24
Agora vamos criar 5 address list uma pra cada link
ip/firewall/address list
+/name:Link1 / 192.168.4.253/ok
+/name:Link2 / 192.168.2.253/ok
+/name:Link3 / 192.168.3.253/ok
+/name:Link4 / 192.168.1.253/ok
+/name:Link5 / 192.168.9.253/ok
Continuando vamos criar todas as regras de mangle
ip/firewall/mangle
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link1#Action/Action: mark connection/New connection mark:Link1/passthrough=yes
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link1#Action/Action: mark routing/New routing mark:Link1/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link2#Action/Action: mark connection/New connection mark:Link2/passthrough=yes
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link2#Action/Action: mark routing/New routing mark:Link2/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link3#Action/Action: mark connection/New connection mark:Link3/passthrough=yes
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link3#Action/Action: mark routing/New routing mark:Link3/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link4#Action/Action: mark connection/New connection mark:Link4/passthrough=yes
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link4#Action/Action: mark routing/New routing mark:Link4/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link5#Action/Action: mark connection/New connection mark:Link5/passthrough=yes
General#chain-prerouting/In. interface: Clientes#Advanced/Src. address list: Link5#Action/Action: mark routing/New routing mark:Link5/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes/Connection State: new#Extra: nth every=4, Counter=4, Packet=0/Action/Action: mark connection/New connection mark:Link1/passthrough=yes
General#chain-prerouting/In. interface: Clientes/Connect mark:Link1#Action/Action: add src to address list/address list:Link1/timeout: 1d 00:00:00
General#chain-prerouting/In. interface: Clientes/Connection mark: Link1#Action/Action: mark routing/New routing mark:Link1/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes/Connection State: new#Extra: nth every=4, Counter=4, Packet=1/Action/Action: mark connection/New connection mark:Link2/passthrough=yes
General#chain-prerouting/In. interface: Clientes/Connect mark:Link2#Action/Action: add src to address list/address list:Link2/timeout: 1d 00:00:00
General#chain-prerouting/In. interface: Clientes/Connection mark: Link2#Action/Action: mark routing/New routing mark:Link2/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes/Connection State: new#Extra: nth every=4, Counter=4, Packet=2/Action/Action: mark connection/New connection mark:Link3/passthrough=yes
General#chain-prerouting/In. interface: Clientes/Connect mark:Link3#Action/Action: add src to address list/address list:Link3/timeout: 1d 00:00:00
General#chain-prerouting/In. interface: Clientes/Connection mark: Link3#Action/Action: mark routing/New routing mark:Link3/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes/Connection State: new#Extra: nth every=4, Counter=4, Packet=3/Action/Action: mark connection/New connection mark:Link4/passthrough=yes
General#chain-prerouting/In. interface: Clientes/Connect mark:Link4#Action/Action: add src to address list/address list:Link4/timeout: 1d 00:00:00
General#chain-prerouting/In. interface: Clientes/Connection mark: Link4#Action/Action: mark routing/New routing mark:Link4/passthrough=no
---------------------------------------------------------------------------------------------
General#chain-prerouting/In. interface: Clientes/Connection State: new#Extra: nth every=4, Counter=4, Packet=4/Action/Action: mark connection/New connection mark:Link5/passthrough=yes
General#chain-prerouting/In. interface: Clientes/Connect mark:Link5#Action/Action: add src to address list/address list:Link5/timeout: 1d 00:00:00
General#chain-prerouting/In. interface: Clientes/Connection mark: Link5#Action/Action: mark routing/New routing mark:Link5/passthrough=no
---------------------------------------------------------------------------------------------
Bom ufa...finalizado as regras de mangle vamos pra regras de nat...
General#chain:srcnat/Connection mark: Link1#Action/Action: src-nat/to addresses:192.168.4.253/to ports: 0-65535
General#chain:srcnat/Connection mark: Link2#Action/Action: src-nat/to addresses:192.168.2.253/to ports: 0-65535
General#chain:srcnat/Connection mark: Link3#Action/Action: src-nat/to addresses:192.168.3.253/to ports: 0-65535
General#chain:srcnat/Connection mark: Link4#Action/Action: src-nat/to addresses:192.168.1.253/to ports: 0-65535
General#chain:srcnat/Connection mark: Link5#Action/Action: src-nat/to addresses:192.168.9.253/to ports: 0-65535
----------------------------------------------------------------------------------------------
Finalmente as regras de ip/route list...vamos lá
Destination: 0.0.0.0/0
gateway: 192.168.4.254
Mark: Link1
Destination: 0.0.0.0/0
gateway: 192.168.2.254
Mark: Link2
Destination: 0.0.0.0/0
gateway: 192.168.3.254
Mark: Link3
Destination: 0.0.0.0/0
gateway: 192.168.1.254
Mark: Link4
Destination: 0.0.0.0/0
gateway: 192.168.9.254
Mark: Link5
Este funciona como meu link principal
Destination: 0.0.0.0/0
gateway: 192.168.4.254
Então pessoal é isto se esqueci de algo pode cobrar e espero que ajude vcs, por que batalhei bastante pra chegar a este cenário e quero deixar claro que não é o balanceamento difinitivo e tem seus pros e contras mas acredito que é um excelente começo pra quem quer balancear links sem ter problemas com bancos e msn, pra aqueles que utilizam hotspot como eu e utiliza o conectividade social tem outras regras complementares pra resolver o problema se alguem tiver duvida pode perguntar... e se ajudou alguem este post por favor agradeça... Pois é o meu salario rs rs rs rs rs....
Abraços e até a proxima.
Felicidades pra todos!!!!!!!!!!!!