/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local comment=”” \
disabled=no
add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=wlan2 \
comment=”” disabled=no
add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=wlan1 \
comment=”” disabled=no
/ ip firewall mangle
add chain=prerouting in-interface=Local connection-state=new nth=1,1,0 \
action=mark-connection new-connection-mark=odd passthrough=yes comment=”” \
disabled=no
add chain=prerouting in-interface=Local connection-mark=odd action=mark-routing \
new-routing-mark=odd passthrough=no comment=”” disabled=no
add chain=prerouting in-interface=Local connection-state=new nth=1,1,1 \
action=mark-connection new-connection-mark=even passthrough=yes comment=”” \
disabled=no
add chain=prerouting in-interface=Local connection-mark=even action=mark-routing \
new-routing-mark=even passthrough=no comment=”” disabled=no
/ ip firewall nat
add chain=srcnat connection-mark=odd action=src-nat to-addresses=10.111.0.2 \
to-ports=0-65535 comment=”” disabled=no
add chain=srcnat connection-mark=even action=src-nat to-addresses=10.112.0.2 \
to-ports=0-65535 comment=”” disabled=no
/ ip route
add dst-address=0.0.0.0/0 gateway=10.111.0.1 scope=255 target-scope=10 routing-mark=odd \
comment=”” disabled=no
add dst-address=0.0.0.0/0 gateway=10.112.0.1 scope=255 target-scope=10 routing-mark=even \
comment=”” disabled=no
add dst-address=0.0.0.0/0 gateway=10.112.0.1 scope=255 target-scope=10 comment=”” \
disabled=no

Mangle

/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local comment=”” \
disabled=no
add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=wlan2 \
comment=”” disabled=no
add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=wlan1 \
comment=”” disabled=no

router punya 2 upstream (WAN) interfaces dengan ip address 10.111.0.2/24 and 10.112.0.2/24. dan interface LAN dengan nama interface “Local” dan ip address 192.168.0.1/24.

/ ip firewall mangle

add chain=prerouting in-interface=Local connection-state=new nth=1,1,0 \
action=mark-connection new-connection-mark=odd passthrough=yes comment=”” \
disabled=no

add chain=prerouting in-interface=Local connection-mark=odd action=mark-routing \
new-routing-mark=odd passthrough=no comment=”” disabled=no

add chain=prerouting in-interface=Local connection-state=new nth=1,1,1 \
action=mark-connection new-connection-mark=even passthrough=yes comment=”” \
disabled=no
add chain=prerouting in-interface=Local connection-mark=even action=mark-routing \
new-routing-mark=even passthrough=no comment=”” disabled=no

NAT

/ ip firewall nat
add chain=srcnat connection-mark=odd action=src-nat to-addresses=10.111.0.2 \
to-ports=0-65535 comment=”” disabled=no
add chain=srcnat connection-mark=even action=src-nat to-addresses=10.112.0.2 \
to-ports=0-65535 comment=”” disabled=no

Routing

/ ip route
add dst-address=0.0.0.0/0 gateway=10.111.0.1 scope=255 target-scope=10 routing-mark=odd \
comment=”” disabled=no
add dst-address=0.0.0.0/0 gateway=10.112.0.1 scope=255 target-scope=10 routing-mark=even \
comment=”” disabled=no
add dst-address=0.0.0.0/0 gateway=10.112.0.1 scope=255 target-scope=10 comment=”” \
disabled=no comment=”gateway for the router itself”
========================================
i’m using two ISPs. indosat (isp 1) is on dedicated bandwidth (512/512kbps), while speedy (isp 2) is on sharing bandwidth (64/384kbps).

interfaces:
1. local (192.168.0.1/24)
2. indosat (10.0.0.254/24)
3. speedy (10.0.1.254/24)

route:
1. default gateway goes to indosat (10.0.0.1/24)
2. another gateway with routing-mark=indosat goes to indosat (10.0.0.1/24)
3. another gateway with routing-mark=speedy goes to speedy (10.0.1.1)/24)

dns:
1. indosat’s dns
2. opendns’ dns

nat:
1. src-nat, out interface indosat, masquerade.
2. src-nat, out interface speedy, masquerade.

mangle:
Code:

10 chain=prerouting src-address=192.168.0.253 action=mark-routing
new-routing-mark=indosat passthrough=no

11 ;;; indosat marking
chain=forward routing-mark=indosat action=mark-connection
new-connection-mark=indosat-connection passthrough=yes

12 chain=forward connection-mark=indosat-connection action=mark-packet
new-packet-mark=indosat passthrough=no

25 chain=prerouting src-address=192.168.1.254 action=mark-routing
new-routing-mark=speedy passthrough=no

26 ;;; speedy marking
chain=forward routing-mark=speedy action=mark-connection
new-connection-mark=speedy-connection passthrough=yes

27 chain=forward connection-mark=speedy-connection action=mark-packet
new-packet-mark=speedy passthrough=no

queue type:
Code:

5 name=”pcq-download” kind=pcq pcq-rate=0 pcq-limit=50
pcq-classifier=dst-address pcq-total-limit=2000

6 name=”pcq-upload” kind=pcq pcq-rate=0 pcq-limit=50
pcq-classifier=src-address pcq-total-limit=2000

queue tree:
Code:

0 name=”download” parent=global-out packet-mark=”” limit-at=0 queue=default
priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

1 name=”indosat-download” parent=download packet-mark=indosat limit-at=0
queue=pcq-download priority=8 max-limit=512000 burst-limit=0
burst-threshold=0 burst-time=0s

2 name=”speedy-download” parent=download packet-mark=speedy limit-at=0
queue=pcq-download priority=8 max-limit=0 burst-limit=0
burst-threshold=0 burst-time=0s

3 name=”indosat-upload” parent=indosat packet-mark=indosat limit-at=0
queue=pcq-upload priority=8 max-limit=512000 burst-limit=0
burst-threshold=0 burst-time=0s

4 name=”speedy-upload” parent=speedy packet-mark=speedy limit-at=0
queue=pcq-upload priority=8 max-limit=0 burst-limit=0 burst-threshold=0
burst-time=0s

sumber : forum mikrotik