I'm currently using a config with dual WAN for failover and load balancing traffic.
The setup is working fine, but since it was based on reading articles and few other posts, I'd like to see whether there are possible improvements mainly in term of logical rule order and bad usage of passthrough=yes/no that might be working, but not formally correct in this implementation or due to mistakes covering other mistakes.
I'm using 2 address-lists to avoid load balancing some IP.
Code: Select all
/ip firewall mangle
add action=accept chain=prerouting comment=\
"Allow connected networks to skip load balance" \
dst-address-list=ConnectedNetworks in-interface=bridge-vpn-lan
add action=mark-connection chain=prerouting comment=\
"Create Mangle rules that will sort the traffic into streams WAN1" \
connection-mark=no-mark dst-address-type=!local in-interface=\
bridge-vpn-lan new-connection-mark=WAN1_conn passthrough=yes \
per-connection-classifier=both-addresses:2/0 src-address-list=\
!LB_Disabled
add action=mark-connection chain=prerouting comment=\
"Create Mangle rules that will sort the traffic into streams WAN2" \
connection-mark=no-mark dst-address-type=!local in-interface=\
bridge-vpn-lan new-connection-mark=WAN2_conn passthrough=yes \
per-connection-classifier=both-addresses:2/1 src-address-list=\
!LB_Disabled
add action=mark-routing chain=prerouting comment="Create the routing marks \
based on the conn mark for WAN1" connection-mark=WAN1_conn \
in-interface=bridge-vpn-lan new-routing-mark=route_WAN1 passthrough=yes
add action=mark-routing chain=prerouting comment="Create the routing marks \
based on the conn mark for WAN2" connection-mark=WAN2_conn \
in-interface=bridge-vpn-lan new-routing-mark=route_WAN2 passthrough=yes
add action=mark-routing chain=output comment="This ensures traffic from the ro\
uter returns through the proper interface WAN1" connection-mark=WAN1_conn \
dst-address-list=!ConnectedNetworks new-routing-mark=route_WAN1 \
passthrough=yes
add action=mark-routing chain=output comment="This ensures traffic from the ro\
uter returns through the proper interface WAN2" connection-mark=WAN2_conn \
dst-address-list=!ConnectedNetworks new-routing-mark=route_WAN2 \
passthrough=yes
add action=mark-connection chain=prerouting comment="Identify which WAN interf\
ace the traffic came in and mark the connection" connection-mark=no-mark \
in-interface=ether1-WAN1 new-connection-mark=WAN1_conn passthrough=yes
add action=mark-connection chain=prerouting comment="Identify which WAN interf\
ace the traffic came in and mark the connection" connection-mark=no-mark \
in-interface=ether2-WAN2 new-connection-mark=WAN2_conn passthrough=yes
Armando.