mTik_Ops Blog

MikroTik PCC Load Balancing Guide (Scalable for Multiple ISPs)

Load balancing multiple internet connections is one of the most effective ways to improve bandwidth utilization and redundancy in your network. MikroTik provides a powerful method called PCC (Per Connection Classifier), which distributes traffic across multiple WAN links based on connection hashing. We'll walk through; How PCC load balancing works, A working multi-WAN configuration, How to scale it to 3 or more ISPs

Published Apr 19, 2026 3 min read MikroTik Guides
MikroTik PCC Load Balancing Guide (Scalable for Multiple ISPs)

What is PCC?

Per Connection Classifier (PCC) distributes traffic by classifying connections into buckets based on parameters like:

  • Source IP
  • Destination IP
  • Port combinations

Each connection is then consistently routed through the same WAN, preventing session breakage.

Network Assumptions

  • Port1: WAN1
  • Port2: WAN2
  • LAN interfaces grouped in LAN interface list

Dual ISP PCC Configuration

Below is a working MikroTik mangle configuration for dual WAN load balancing:

/ip firewall mangle
add action=mark-connection chain=prerouting comment="================================================== PCC LOAD BALANCE ========================================" connection-mark=no-mark connection-state=new in-interface="Port1: WAN1" \
    new-connection-mark=wan1_conn
add action=mark-connection chain=prerouting connection-mark=no-mark connection-state=new in-interface="Port2: WAN2" new-connection-mark=wan2_conn

add action=mark-connection chain=prerouting connection-mark=no-mark connection-state=new dst-address-type=!local in-interface-list=LAN \
    new-connection-mark=wan1_conn per-connection-classifier=src-address-and-port:2/0

add action=mark-connection chain=prerouting connection-mark=no-mark connection-state=new dst-address-type=!local in-interface-list=LAN \
    new-connection-mark=wan2_conn per-connection-classifier=src-address-and-port:2/1

add action=mark-routing chain=prerouting connection-mark=wan1_conn in-interface-list=LAN new-routing-mark=wan1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=wan2_conn in-interface-list=LAN new-routing-mark=wan2 passthrough=no

add action=mark-routing chain=output connection-mark=wan1_conn new-routing-mark=wan1
add action=mark-routing chain=output connection-mark=wan2_conn new-routing-mark=wan2

How It Works

1. Connection Marking (Inbound WAN)

These rules ensure return traffic exits the same WAN it entered:

in-interface="Port1: WAN1" → wan1_conn  
in-interface="Port2: WAN2" → wan2_conn

2. PCC Classification (LAN Traffic)

per-connection-classifier=src-address-and-port:2/0 → WAN1  
per-connection-classifier=src-address-and-port:2/1 → WAN2
  • 2 = total WAN links
  • 0 and 1 = bucket indexes

3. Routing Marking

Each connection mark is mapped to a routing table:

wan1_conn → routing-mark=wan1  
wan2_conn → routing-mark=wan2

Scaling to 3 or More ISPs

Step 1: Add Connection Marks

new-connection-mark=wan1_conn
new-connection-mark=wan2_conn
new-connection-mark=wan3_conn

Step 2: Adjust PCC Buckets

per-connection-classifier=src-address-and-port:3/0 → WAN1
per-connection-classifier=src-address-and-port:3/1 → WAN2
per-connection-classifier=src-address-and-port:3/2 → WAN3

Step 3: Add Routing Marks

wan1_conn → routing-mark=wan1
wan2_conn → routing-mark=wan2
wan3_conn → routing-mark=wan3

Example: 4 ISPs

per-connection-classifier=src-address-and-port:4/0 → WAN1
per-connection-classifier=src-address-and-port:4/1 → WAN2
per-connection-classifier=src-address-and-port:4/2 → WAN3
per-connection-classifier=src-address-and-port:4/3 → WAN4

Key Rule for Scaling

Total PCC divisor = number of WAN links

Best Practices

1. Always Exclude Local Traffic

dst-address-type=!local

Prevents internal traffic from being load balanced.

2. Use Interface Lists

Instead of hardcoding LAN ports:

in-interface-list=LAN

This keeps configs clean and scalable.

3. Ensure Proper Routing Tables

Make sure you have routes like:

/ip route
add gateway=ISP1_GW routing-mark=wan1
add gateway=ISP2_GW routing-mark=wan2

4. NAT Per WAN

/ip firewall nat
add chain=srcnat out-interface=Port1 action=masquerade
add chain=srcnat out-interface=Port2 action=masquerade

Conclusion

PCC load balancing on MikroTik is:

  • Efficient
  • Scalable
  • Reliable for multi-WAN environments

Once you understand the logic, expanding from 2 to 3, 4, or more ISPs becomes straightforward - just adjust the PCC divisor and buckets.

Final Tip

If you plan to scale frequently, design your configuration like a template so adding new ISPs becomes plug-and-play.


Build with mTik_Ops

Launch these ideas in your live environment

Use the platform to run billing, subscribers, hotspot operations, and support workflows from one panel.