MikroTik PCC Generator

Generate MikroTik PCC (Per Connection Classifier) load balancing configuration scripts for RouterOS 6 and 7. Easily create multi-WAN PCC routing, mangle rules, routing marks, and load balancing configurations with automatic PCC calculation and script generation online.
Loading...
General Configuration
RouterOS VersionLAN Interface
WAN Configuration
GatewayInterfaceDownloadUploadAction
PCC Summary
WANPCC RemainderWeight
ISP-10/250.00%
ISP-21/250.00%
Generated Script
WAN Count: 2PCC Divisor: 2

Overview

The MikroTik PCC Generator builds a Per Connection Classifier load balancing script that spreads new connections across multiple WAN links. You enter each WAN's name, gateway, interface, and speeds, and the tool computes the classifier divisor, the per-link remainder, and a weight. The output contains firewall mangle marking rules plus one routing table entry per link, using routing-table syntax for RouterOS 7 and routing-mark syntax for RouterOS 6.

Common Use Cases

How to Use

1
Select the RouterOS version and enter the LAN interface that clients use to reach the router.
2
Fill in each WAN row with the ISP name, gateway, interface, download speed, and upload speed, using Add WAN to include more links.
3
Review the PCC Summary, which shows each WAN's remainder (index/divisor) and the weight percentage derived from the download speed.
4
Copy the generated script and paste it into the MikroTik terminal, then verify the routes against the existing routing table.

Example Scenario

Two ISPs, equal split

With ISP-1 at gateway 192.168.1.1 on ether1 and ISP-2 at gateway 192.168.2.1 on ether2, both set to 100 Mbps download, the divisor becomes 2. The classifier rules use per-connection-classifier=both-addresses-and-ports:2/0 and 2/1 on prerouting, each WAN shows a 50.00% weight, and the router receives one route per ISP pointing at each gateway.

Technical Notes

The PCC divisor equals the total number of WAN links you define. Each link is assigned one remainder written as index/divisor, so two links produce the remainders 0/2 and 1/2.

The mangle rules use per-connection-classifier=both-addresses-and-ports, which hashes source and destination addresses and ports so every packet of one connection follows the same link.

Each link receives a connection mark named after the ISP, for example ISP-1_conn, and a matching routing mark ISP-1_route, so return and related traffic stays on the same path.

The weight shown in the PCC Summary is each link's download speed divided by the total download speed. It is informational only; the generated classifier divides connections evenly by count.

For RouterOS 7 the route uses routing-table=<name>_route, while RouterOS 6 uses the older routing-mark=<name>_route syntax. Pick the version matching the router before copying the script.

The interface and upload fields are captured in the form, but the generated script only uses the ISP name, gateway, and download speed for the weight calculation.

Common Mistakes

Frequently Asked Questions

Per Connection Classifier hashes the addresses and ports of a connection and assigns it to one of several groups, one per WAN, so each new connection consistently follows the same link.

The weight is calculated only from the download value you enter. The script itself always divides connections evenly by the number of WANs, so the weight is advisory.

No. The generated mangle rules already create both the connection mark and the routing mark in the prerouting chain, so basic load balancing needs no extra rules.

The format is both-addresses-and-ports:<total>:<remainder>. With two WANs you get 2/0 and 2/1, and the router classifies each new connection into one of the two groups.

Enter the ISP gateway on the router's side of each link, such as 192.168.1.1 for ether1. The generated route for each link points at that gateway.

Related Topics