How to Setup Load Balancing using PCC on Mikrotik

Load Balancing is a technique used to send network traffic over multiple gateways. If you have multiple ISP connections in your network, you can send your network traffic through those ISP connections and make a load balanced network.

In this tutorial I am explaining how to create a Load Balancing setup using the PCC (Per connection classifier) method on Mikrotik routers. We will combine two internet connection into our local network and also get fail over if one line is unreachable.

With PCC you can add as many lines as you wish using the same method. Conceptually, this video tutorial will cover the whole process of PCC load balancing and you can merge any number of lines if you watch the video accordingly.

My complete setup export as seen in the video, you can use it to see each step in detail and as a starting, research point for your setup. Please make sure to re import it on a blank router:

/interface bridge
add name=localnetwork
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=localnetwork name=dhcp1
/interface bridge port
add bridge=localnetwork interface=ether3
/ip address
add address= interface=ether1 network=
add address= interface=ether2 network=
add address= interface=localnetwork network=
/ip dhcp-server network
add address= gateway=
/ip dns
set servers=,
/ip firewall mangle
add action=mark-connection chain=prerouting connection-state=new \
in-interface=ether1 new-connection-mark=wan1 passthrough=yes
add action=mark-connection chain=prerouting connection-state=new \
in-interface=ether2 new-connection-mark=wan2 passthrough=yes
add action=mark-routing chain=output connection-mark=wan1 new-routing-mark=\
wan1-out passthrough=yes
add action=mark-routing chain=output connection-mark=wan2 new-routing-mark=\
wan2-out passthrough=yes
add action=mark-connection chain=prerouting connection-state=new \
dst-address-type=!local in-interface=localnetwork new-connection-mark=\
wan1 passthrough=yes per-connection-classifier=both-addresses:2/0
add action=mark-connection chain=prerouting connection-state=new \
dst-address-type=!local in-interface=localnetwork new-connection-mark=\
wan2 passthrough=yes per-connection-classifier=both-addresses:2/1
add action=mark-routing chain=prerouting connection-mark=wan1 in-interface=\
localnetwork new-routing-mark=wan1output passthrough=yes
add action=mark-routing chain=prerouting connection-mark=wan2 in-interface=\
localnetwork new-routing-mark=wan2output passthrough=yes
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1
add action=masquerade chain=srcnat out-interface=ether2
/ip route
add check-gateway=ping distance=1 gateway= routing-mark=wan1output
add check-gateway=ping distance=2 gateway= routing-mark=wan2output
add check-gateway=ping distance=1 gateway=
add check-gateway=ping distance=2 gateway=
/system clock
set time-zone-name=Europe/Vienna
/system identity
set name="Core Load Balancer"

How PCC Works:

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most discussed

Get your e-mail updates

Sign up and get your news fix directly to your inbox. Nothing more nothing else and definitely no spam.
Email address
We won't share your e-mail or send spam