Page 1 of 1
load balancing two wan link
Posted: Tue Mar 12, 2013 9:56 pm
by Abdock
I have 2 links to an ISP and each one is capable of 50 mbps, how can i merge these links to get 100 and also get redundancy in case one fails the other works at 50.
At the moment we only use one link which is 50 mbps.
many thanks !
Re: load balancing two wan link
Posted: Tue Mar 12, 2013 10:02 pm
by elcowboy
Re: load balancing two wan link
Posted: Wed Mar 13, 2013 7:02 am
by dotnet
Here is describes 2 Method for your load balancing.
++++
PCC
++++
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=192.168.2.1/24 network=192.168.2.0 broadcast=192.168.2.255 interface=wan1
add address=192.168.4.1/24 network=192.168.4.0 broadcast=192.168.4.255 interface=wan2
/ip route
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_wan1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.4.1 routing-mark=to_wan2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.4.1 distance=2 check-gateway=ping
/ip firewall nat
add action=masquerade chain=srcnat disabled=no out-interface=wan1
add action=masquerade chain=srcnat disabled=no out-interface=wan2
/ip firewall mangle
add action=mark-connection chain=input disabled=no in-interface=wan1 new-connection-mark= wan1_conn passthrough=yes
add action=mark-connection chain=input disabled=no in-interface= wan2 new-connection-mark= wan2_conn passthrough=yes
add action=mark-connection chain=output disabled=no dst-port=80 new-connection-mark=wan1_conn passthrough=yes per-connection-classifier=both-addresses:2/0 protocol=tcp
add action=mark-connection chain=output disabled=no dst-port=80 new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=both-addresses:2/1 protocol=tcp
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local dst-port=!80 in-interface=Local new-connection-mark= wan1_conn passthrough=yes per-connection-classifier=both-addresses:2/0 protocol=tcp
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local dst-port=!80 in-interface=Local new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=both-addresses:2/1 protocol=tcp
add action=mark-routing chain=prerouting connection-mark=wan1_conn disabled=no in-interface=Local new-routing-mark=to_wan1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=wan2_conn disabled=no in-interface=Local new-routing-mark=to_wan2 passthrough=yes
add action=mark-routing chain=output connection-mark=wan1_conn disabled=no new-routing-mark=to_wan1 passthrough=yes
add action=mark-routing chain=output connection-mark=wan2_conn disabled=no new-routing-mark=to_wan2 passthrough=yes
/ip dns
set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.8.8, 8.8.4.4
..........................................................................
++++++
ECMP
++++++
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=LOCAL
add address=192.168.2.1/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN1
add address=192.168.4.1/24 network=192.168.4.0 broadcast=192.168.4.255 interface=WAN2
/ ip route
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN1
add dst-address=0.0.0.0/0 gateway=192.168.4.1 routing-mark=to_WAN2
add dst-address=0.0.0.0/0 gateway=192.168.2.1,192.168.4.1 check-gateway=ping
/ ip firewall nat
add chain=srcnat out-interface=WAN1 action=masquerade
add chain=srcnat out-interface=WAN2 action=masquerade
/ ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn
add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2
/ip dns
set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.8.8, 8.8.4.4
*** Please don't copy-paste ..... just follow the rules.
Re: load balancing two wan link
Posted: Wed Mar 13, 2013 8:09 pm
by Abdock
Thanks for the good responses, the router i have does not do nat, and all is on public IP. I will try and see if these posted method works.
thanks.