Fix PCC load balancing

Hi everyone, I have two uplinks in my Mikrotik; the PCC doesn’t work correctly. So I want to share my configuration

export

# feb/24/2026 16:43:47 by RouterOS 6.49.19

# software id = IMZ4-9E23

# 

# model = RB750Gr3

# serial number = /removed by mod/

/interface ethernet
set \[ find default-name=ether3 \] mac-address=C4:AD:34:95:33:08
set \[ find default-name=ether4 \] mac-address=C4:AD:34:95:33:09
set \[ find default-name=ether1 \] mac-address=C4:AD:34:95:33:06 name=ether_ISP1
set \[ find default-name=ether2 \] disabled=yes mac-address=C4:AD:34:95:33:07 
name=ether_ISP2
set \[ find default-name=ether5 \] mac-address=C4:AD:34:95:33:0A name=ether_LAN
/interface wireless security-profiles
set \[ find default=yes \] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=192.168.100.2-192.168.100.254
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether_LAN name=dhcp1
/interface detect-internet
set detect-interface-list=all
/ip address
add address=192.168.1.104/24 interface=ether_ISP1 network=192.168.1.0
add address=192.168.2.104/24 interface=ether_ISP2 network=192.168.2.0
add address=192.168.100.1/24 interface=ether_LAN network=192.168.100.0
/ip cloud
set ddns-enabled=yes
/ip dhcp-server network
add address=192.168.100.0/24 dns-server=8.8.8.8 gateway=192.168.100.1
/ip dns
set servers=8.8.8.8,1.1.1.1
/ip firewall mangle
add action=accept chain=prerouting dst-address=192.168.2.0/24 in-interface=
ether_LAN
add action=accept chain=prerouting dst-address=192.168.100.0/24
add action=accept chain=prerouting dst-address=192.168.1.0/24 in-interface=
ether_LAN
add action=mark-connection chain=prerouting connection-mark=no-mark 
connection-state=new in-interface=ether_ISP2 new-connection-mark=ISP2 
passthrough=yes
add action=mark-connection chain=prerouting connection-mark=no-mark 
connection-state=new in-interface=ether_ISP1 new-connection-mark=ISP1 
passthrough=yes
add action=mark-routing chain=output connection-mark=ISP2 new-routing-mark=
ISP2_table
add action=mark-routing chain=output connection-mark=ISP1 new-routing-mark=
ISP1_table
add action=mark-connection chain=prerouting comment=pcc connection-mark=no-mark 
connection-state=new dst-address-type=!local in-interface=ether_LAN 
new-connection-mark=ISP2 passthrough=yes per-connection-classifier=
both-addresses:2/1
add action=mark-connection chain=prerouting comment="pcc 1" connection-mark=
no-mark connection-state=new dst-address-type=!local in-interface=ether_LAN 
new-connection-mark=ISP1 passthrough=yes per-connection-classifier=
both-addresses:2/0
add action=mark-connection chain=input connection-state=new in-interface=
ether_ISP1 new-connection-mark=ISP1
add action=mark-connection chain=input connection-state=new in-interface=
ether_ISP2 new-connection-mark=ISP2
add action=mark-routing chain=prerouting connection-mark=ISP1 in-interface=
ether_LAN new-routing-mark=ISP1_table
add action=mark-routing chain=prerouting connection-mark=ISP2 in-interface=
ether_LAN new-routing-mark=ISP2_table
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether_ISP1
add action=masquerade chain=srcnat out-interface=ether_ISP2
add action=dst-nat chain=dstnat comment="Winbox to Hotspot" dst-address=
192.168.1.104 dst-port=8888 protocol=tcp to-addresses=192.168.100.104 
to-ports=8291
add action=dst-nat chain=dstnat comment="Winbox to Hotspot" dst-address=
192.168.2.104 dst-port=8888 protocol=tcp to-addresses=192.168.100.104 
to-ports=8291
add action=dst-nat chain=dstnat comment="HTTP to Hotspot" dst-address=
192.168.1.104 dst-port=8080 protocol=tcp to-addresses=192.168.100.104 
to-ports=80
/ip route
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=ISP2_table
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=ISP1_table
add distance=1 gateway=192.168.1.1
add distance=2 gateway=192.168.2.1
/system clock
set time-zone-name=Asia/Hebron
/system identity

Hi.

What the first 3 action=accept chain=prerouting rules do? Are you sure those are not preventing your traffic to be processed by the rest of the chain?

i don’t have experience in load balancing. I saw in youtube video, and I followed what he did.
”so i want to someone who to do or solve load balancing

The problem with Youtube videos is that they are often made by people without a clue what they are talking about.

Do not follow advise from Youtube videos unless they are from the MikroTik Youtube channel.

To setup failover/load_balancing use the MikroTik manual instead.

- Failover (WAN Backup) - RouterOS - MikroTik Documentation

- Per connection classifier - RouterOS - MikroTik Documentation

I did the Load balancing from Mikrotik as you mentioned, and everything is good in the beginning, but when one of the uplinks is down, e.g 192.168.2.1, the route is still reachable and maybe get no internet connection , i added in netwatch to disable route when it is down , suddenly the two uplinks is disabled ang not to get back up .

@pe1chl look at my configuration you will see like the manual in PCC.

In addition when i do ping in 192.168.2.1 the ping is ok , but when 8.8.8.8 on ether-ISP2 , the ping timeout ,

i think there is a real problem i don’t understand where ,

Do the failover in the way described in the first document above. Failover and PCC are independent.

Here is my configuration according the decoumention

@pe1chl

jan/02/1970 00:30:21 by RouterOS 6.49.19

software id = WDKU-F2L4

model = RB750Gr3

/interface ethernet
set [ find default-name=ether1 ] name=ether_ISP1
set [ find default-name=ether2 ] name=ether_ISP2
set [ find default-name=ether3 ] name=ether_LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
set [ find default=yes ] html-directory=hotspot
/ip pool
add name=dhcp_pool0 ranges=192.168.100.2-192.168.100.254
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether_LAN name=dhcp1
/ip address
add address=192.168.1.104/24 interface=ether_ISP1 network=192.168.1.0
add address=192.168.2.104/24 interface=ether_ISP2 network=192.168.2.0
add address=192.168.100.1/24 interface=ether_LAN network=192.168.100.0
/ip dhcp-server network
add address=192.168.100.0/24 dns-server=8.8.8.8,1.1.1.1 gateway=
192.168.100.1
/ip firewall mangle
add action=accept chain=prerouting dst-address=10.10.4.0/24
in-interface=ether_LAN
add action=accept chain=prerouting dst-address=10.10.5.0/24
in-interface=ether_LAN
add action=mark-connection chain=input connection-state=new
in-interface=ether_ISP1 new-connection-mark=ISP1
add action=mark-connection chain=input connection-state=new
in-interface=ether_ISP2 new-connection-mark=ISP2
add action=mark-connection chain=output connection-mark=no-mark
connection-state=new new-connection-mark=ISP1
per-connection-classifier=both-addresses:2/0
add action=mark-connection chain=output connection-mark=no-mark
connection-state=new new-connection-mark=ISP2
per-connection-classifier=both-addresses:2/1
add action=mark-connection chain=prerouting connection-mark=no-mark
connection-state=new dst-address-type=!local in-interface=ether_LAN
new-connection-mark=ISP1 per-connection-classifier=
both-addresses:2/0
add action=mark-connection chain=prerouting connection-mark=no-mark
connection-state=new dst-address-type=!local in-interface=ether_LAN
new-connection-mark=ISP2 per-connection-classifier=
both-addresses:2/1
add action=mark-routing chain=output connection-mark=ISP1
new-routing-mark=ISP1_table
add action=mark-routing chain=prerouting connection-mark=ISP1
in-interface=ether_LAN new-routing-mark=ISP1_table
add action=mark-routing chain=output connection-mark=ISP2
new-routing-mark=ISP2_table
add action=mark-routing chain=prerouting connection-mark=ISP2
in-interface=ether_LAN new-routing-mark=ISP2_table
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether_ISP1
add action=masquerade chain=srcnat out-interface=ether_ISP2
/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=
ISP1_table
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=
ISP2_table
add distance=1 gateway=192.168.1.1
add check-gateway=ping distance=1 gateway=8.8.8.8 target-scope=11
add check-gateway=ping distance=1 gateway=208.67.222.222 target-scope=11
add distance=2 gateway=192.168.2.1
add check-gateway=ping distance=2 gateway=8.8.4.4 target-scope=11
add check-gateway=ping distance=2 gateway=208.67.220.220 target-scope=11
add distance=1 dst-address=8.8.4.4/32 gateway=192.168.2.1 scope=10
add distance=1 dst-address=8.8.8.8/32 gateway=192.168.1.1 scope=10
add distance=1 dst-address=208.67.220.220/32 gateway=192.168.2.1 scope=
10
add distance=1 dst-address=208.67.222.222/32 gateway=192.168.1.1 scope=
10

@pe1chl @Dartmaul

i tried another solution ,
but no internet connection in client

model = RB750Gr3

/interface bridge
add name=Bridge_LAN
/interface ethernet
set [ find default-name=ether5 ] name=LAN1
set [ find default-name=ether3 ] name=LAN2
set [ find default-name=ether4 ] name=LAN3
set [ find default-name=ether1 ] name=WAN1
set [ find default-name=ether2 ] name=WAN2
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=192.168.100.2-192.168.100.254
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=Bridge_LAN name=dhcp1
/interface bridge port
add bridge=Bridge_LAN interface=LAN1
add bridge=Bridge_LAN interface=LAN2
add bridge=Bridge_LAN interface=LAN3
/ip address
add address=192.168.2.10/24 interface=WAN1 network=192.168.2.0
add address=192.168.1.10/24 interface=WAN2 network=192.168.1.0
add address=192.168.100.1/24 interface=Bridge_LAN network=192.168.100.0
/ip cloud
set ddns-enabled=yes
/ip dhcp-server network
add address=192.168.100.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=
192.168.100.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip firewall address-list
add address=10.0.0.0/8 list=RFC1918
add address=172.16.0.0/12 list=RFC1918
add address=192.168.0.0/16 list=RFC1918
/ip firewall mangle
add action=mark-connection chain=input in-interface=WAN1
new-connection-mark=Conn1 passthrough=yes
add action=mark-connection chain=input in-interface=WAN2
new-connection-mark=Conn2 passthrough=yes
add action=mark-routing chain=output connection-mark=Conn1
new-routing-mark=WAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=Conn2
new-routing-mark=WAN2 passthrough=yes
add action=accept chain=prerouting in-interface=WAN1
add action=accept chain=prerouting in-interface=WAN2
add action=accept chain=prerouting dst-address-type=local
src-address-type=local
add action=accept chain=prerouting dst-address-list=RFC1918
add action=mark-routing chain=prerouting dst-address-type=!local
new-routing-mark=WAN1 passthrough=no per-connection-classifier=
both-addresses-and-ports:2/0
add action=mark-routing chain=prerouting dst-address-type=!local
new-routing-mark=WAN2 passthrough=no per-connection-classifier=
both-addresses-and-ports:2/1
/ip firewall nat
add action=dst-nat chain=dstnat dst-port=8292 protocol=tcp to-addresses=
192.168.100.100 to-ports=8291
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2
/ip route
add check-gateway=ping distance=1 gateway=1.1.1.1 routing-mark=WAN1
target-scope=30
add distance=2 gateway=192.168.1.1 routing-mark=WAN1
add check-gateway=ping distance=1 gateway=9.9.9.9 routing-mark=WAN2
target-scope=30
add distance=2 gateway=192.168.2.1 routing-mark=WAN2
add distance=1 gateway=192.168.2.1
add distance=1 gateway=192.168.1.1
add distance=1 dst-address=1.1.1.1/32 gateway=192.168.2.1
add distance=1 dst-address=9.9.9.9/32 gateway=192.168.1.1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-name=Asia/Gaza
/system identity
set name=MikroTik_LB
/system ntp client
set enabled=yes primary-ntp=103.186.118.219 secondary-ntp=172.235.18.237
/tool netwatch
add host=192.168.2.1 interval=1s
add host=192.168.1.1 interval=1s
add host=1.1.1.1 interval=10s
add host=9.9.9.9 interval=10s
add host=8.8.8.8 interval=10s

I can’t get my head around most of your mangle rules, except maybe the first 4.

Anyway, that’s how I’d do that

/ip firewall mangle
add action=mark-connection chain=postrouting comment=Just-in-case-you-(will)use-dst-nat connection-mark=no-mark connection-nat-state=dstnat new-connection-mark=dst_natted out-interface=Bridge_LAN
add action=jump chain=prerouting comment=LAN-to-PCC connection-mark=!dst_natted dst-address-list=!RFC1918 in-interface=Bridge_LAN jump-target=pcc_WAN
add action=mark-connection chain=pcc_WAN comment=mark_WAN1 connection-mark=no-mark connection-state=new new-connection-mark=WAN1 per-connection-classifier=both-addresses-and-ports:2/0
add action=mark-connection chain=pcc_WAN comment=mark_WAN2 connection-mark=no-mark connection-state=new new-connection-mark=WAN2 per-connection-classifier=both-addresses-and-ports:2/1
add action=mark-routing chain=pcc_WAN comment=to_WAN1 connection-mark=to_MF new-routing-mark=WAN1 passthrough=no
add action=mark-routing chain=pcc_WAN comment=to_WAN2 connection-mark=to_PSK new-routing-mark=WAN2 passthrough=no

Sorry to bother you. May i have the full code to do PCC + FAILOVER + hotspot in another mikrtoik

i can’t understand all of these just i followed some people

@Dartmaul

I don’t have practical experience doing this with RouterOS v6, I moved on to v7 before trying the recursive routing solution. But I know it works OK for me, using the docs I mentioned above. And also with a more complicated config that allows pinging multiple remote systems to validate the internet connection.

Of course getting something like this to work is beyond “I tried this and it did not work”. You need to build the whole thing in layers from the bottom and validate each step before you move on to the next.