Hi everybody,
A few days ago I activated my second internet connection, and I thought of using both connections at the same time via PCC lod balance.
Both connections are PPPOE type and have dynamic IP but the second connection is behind NAT so i can't use DDNS services to reach my IP address remotly.
I would like to use the PCC load balance only with 3 of the 6 LANs and I would like the remaining 3 to be directed to only one of the two WANs.
To simplify I would like to create such a configuration:
- LAN 1 - PCC (WAN 1 + WAN 2 with failover)
- LAN 2 - PCC (WAN 1 + WAN 2 with failover)
- LAN 3 - PCC (WAN 1 + WAN 2 with failover)
- LAN 4 - WAN 1
- LAN 5 - WAN 1
- LAN 6 - WAN 2
I did step by step tests using the PCC load balance in the beginning only with one LAN and the two WANs.
This is the configuration I've used:
(pppoe-1=WAN 1)
(pppoe-2=WAN 2)
(bridge_1=LAN 1)
(bridge_2=LAN 2)
/ip firewall mangle
add chain=input in-interface=pppoe-1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=pppoe-2 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
add chain=prerouting dst-address-type=!local in-interface=bridge_1 per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=bridge_1 per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
add chain=prerouting connection-mark=WAN1_conn in-interface=bridge_1 action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=bridge_1 action=mark-routing new-routing-mark=to_WAN2
/ip route
add dst-address=0.0.0.0/0 gateway=pppoe-1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-2 routing-mark=to_WAN2 check-gateway=ping
/ip firewall nat
add chain=srcnat out-interface=pppoe-1 action=masquerade
add chain=srcnat out-interface=pppoe-2 action=masquerade
This configuration works very good.
The first problem came when I tried to apply this configuration to two LANs simultaneously.
This is the configuration I've used:
/ip firewall mangle
# LAN 1
add chain=input in-interface=pppoe-1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=pppoe-2 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
add chain=prerouting dst-address-type=!local in-interface=bridge_1 per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=bridge_1 per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
add chain=prerouting connection-mark=WAN1_conn in-interface=bridge_1 action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=bridge_1 action=mark-routing new-routing-mark=to_WAN2
# LAN 2
add chain=input in-interface=pppoe-1 action=mark-connection new-connection-mark=WAN3_conn
add chain=input in-interface=pppoe-2 action=mark-connection new-connection-mark=WAN4_conn
add chain=output connection-mark=WAN3_conn action=mark-routing new-routing-mark=to_WAN3
add chain=output connection-mark=WAN4_conn action=mark-routing new-routing-mark=to_WAN4
add chain=prerouting dst-address-type=!local in-interface=bridge_2 per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN3_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=bridge_2 per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN4_conn passthrough=yes
add chain=prerouting connection-mark=WAN3_conn in-interface=bridge_2 action=mark-routing new-routing-mark=to_WAN3
add chain=prerouting connection-mark=WAN4_conn in-interface=bridge_2 action=mark-routing new-routing-mark=to_WAN4
/ip route
add dst-address=0.0.0.0/0 gateway=pppoe-1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-2 routing-mark=to_WAN2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-1 routing-mark=to_WAN3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-2 routing-mark=to_WAN4 check-gateway=ping
/ip firewall nat
add chain=srcnat out-interface=pppoe-1 action=masquerade
add chain=srcnat out-interface=pppoe-2 action=masquerade
Using this configuration it seems that the PCC load balance works with both LANs but the LANs can no longer communicate with each other.