and this my configuration:
Network Overview
IP Addressing
| Interface |
IP Address |
Network |
| ether3 |
192.168.10.2/24 |
192.168.10.0/24 |
| ether4 |
192.168.20.2/24 |
192.168.20.0/24 |
| ether5 |
192.168.30.2/24 |
192.168.30.0/24 |
| ether1 |
DHCP (dynamic) |
ISP 1 |
| ether2 |
DHCP (dynamic) |
ISP 2 |
DHCP Configuration
IP Pools
/ip pool
add name=dhcp_pool1 ranges=192.168.20.1,192.168.20.3-192.168.20.254
add name=dhcp_pool2 ranges=192.168.10.1,192.168.10.3-192.168.10.254
add name=dhcp_pool3 ranges=192.168.30.1,192.168.30.3-192.168.30.254
DHCP Servers
/ip dhcp-server
add name=dhcp1 interface=ether3 address-pool=dhcp_pool2 lease-time=12h
add name=dhcp2 interface=ether4 address-pool=dhcp_pool1 lease-time=12h
add name=dhcp3 interface=ether5 address-pool=dhcp_pool3 lease-time=12h
DHCP Networks
/ip dhcp-server network
add address=192.168.10.0/24 gateway=192.168.10.2
add address=192.168.20.0/24 gateway=192.168.20.2
add address=192.168.30.0/24 gateway=192.168.30.2
DNS
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,1.1.1.1
Bandwidth Limitation (Simple Queue + PCQ)
-
LAN on ether3 limited to 50 Mbps
-
LAN on ether4 limited to 50 Mbps
-
Using PCQ for fair bandwidth distribution per client
/queue simple
add name="LAN-192.168.10.0" target=192.168.10.0/24 \
max-limit=50M/50M queue=pcq-upload-default/pcq-download-default
add name="LAN-192.168.20.0" target=192.168.20.0/24 \
max-limit=50M/50M queue=pcq-upload-default/pcq-download-default
Routing Tables
/routing table
add name=TO-ISP1 fib=yes
add name=TO-ISP2 fib=yes
Firewall Mangle (PCC Load Balancing)
Bypass Local Traffic
/ip firewall mangle
add chain=prerouting action=accept dst-address=10.11.24.0/21
add chain=prerouting action=accept dst-address=192.168.1.0/24
add chain=prerouting action=accept dst-address=192.168.10.0/24
add chain=prerouting action=accept dst-address=192.168.20.0/24
add chain=prerouting action=accept dst-address=192.168.30.0/24
Mark Incoming WAN Connections
add chain=prerouting in-interface=ether1 action=mark-connection new-connection-mark=ISP1
add chain=prerouting in-interface=ether2 action=mark-connection new-connection-mark=ISP2
PCC (src-address, ratio 13:12)
(example shown, full list unchanged)
add chain=prerouting in-interface=ether3 \
per-connection-classifier=src-address:13/0 \
action=mark-connection new-connection-mark=ISP1
Mark Routing
add chain=prerouting in-interface=ether3 connection-mark=ISP1 \
action=mark-routing new-routing-mark=TO-ISP1
add chain=prerouting in-interface=ether3 connection-mark=ISP2 \
action=mark-routing new-routing-mark=TO-ISP2
add chain=output connection-mark=ISP1 action=mark-routing new-routing-mark=TO-ISP1
add chain=output connection-mark=ISP2 action=mark-routing new-routing-mark=TO-ISP2
NAT
/ip firewall nat
add chain=srcnat out-interface=ether1 action=masquerade
add chain=srcnat out-interface=ether2 action=masquerade
Routes
/ip route
add dst-address=0.0.0.0/0 gateway=10.11.24.1 routing-table=TO-ISP1 \
check-gateway=ping distance=1
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-table=TO-ISP2 \
check-gateway=ping distance=1
add dst-address=0.0.0.0/0 gateway=10.11.24.1 routing-table=TO-ISP2 distance=2
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-table=TO-ISP1 distance=2