Beruflich Dokumente
Kultur Dokumente
dusuniot.com OPE
Search …
Home » Load Balancing • MikroTik Router » MikroTik Dual WAN Load 744 people like this. Sign Up
Like Share what your friends like.
Balancing with Failover using PCC
Load Balancing and Link Redundancy network and in this article I will discuss include all the packages those are
developed by MikroTik team. So,
how to configure PCC Load Balancing and Link Redundancy network with
sometimes you may find that some
MikroTik Router over Dual Gateway.
packages are missing in your
Core Devices and IP Information RouterOS such as NTP package,
DUDE package, Wireless package,
To configure a load balancing with failover network, I am using MikroTik
CAPsMAN package and so on.
RouterOS v6.38.1 that has two ISP connections and a LAN network. IP Specially, user manager package
information that I am using for this network configuration are given below. which is totally a separate [...]Read
More »
ISP1 IP 192.168.30.2/30 and Gateway IP 192.168.30.1
ISP2 IP 192.168.60.2/30 and Gateway IP 192.168.60.1
LAN network: 10.10.70.0/24 and LAN Gateway IP 10.10.70.1/24
DNS IP: 8.8.8.8 and 8.8.4.4
SPONSORED SEARCHES
This IP information is just for my RND purpose. Change this information dual wan load balancing
according to your network requirements.
load balance mikrotik
Network Diagram
best load balancing router
To configure a Load Balancing and Link Redundancy network with MikroTik
RouterOS, I am following a network diagram like below image. mikrotik router winbox
MikroTik Router 74
Red Hat/CentOS 24
Linux
RADIUS Server 16
Dual WAN Load Balancing and Link Redundancy Network
Linux Server 13
In this network, MikroTik Router’s 1st Interface (ether1) is connected to ISP1 Configuration
having IP Address 192.168.30.2/30 and 2nd Interface (ether2) is connected to
Linux System 12
ISP2 having IP Address 192.168.60.2/30. In real network these IP Addresses
Administration
should replace with your ISP given public IP Address. Again, 3rd Interface
(ether3) is connected to LAN having IP network 10.10.70.0/24. VPN Configuration 11
Load Balancing 9
We will configure Dual WAN Load Balancing and Link Redundancy in this
MikroTik Router using PCC method and after PCC configuration MikroTik MikroTik Firewall 8
will pass LAN traffic through both ISP equally and if any ISP is disconnected,
Windows Tips & 7
other ISP will be used to pass all traffic until the disconnected ISP becomes Tricks
alive. If disconnected ISP becomes alive, both ISP will be used to pass LAN
FreeRADIUS Server 7
traffic again automatically.
DHCP Server 5
How PCC Works Hotspot Configuration 5
PCC (Per Connection Classifier) uses hash function to divide traffics. Hash
Firefox Tips & Tricks 4
function has many interesting properties, but only one that is used for PCC
method is that hash function is deterministic. That means if same input is PPPoE Server 4
given to hash function, it always generates same output. For example, if we Configuration
provide a specific IP address to hash function multiple times, it always Internet Tips & Tricks 3
generates a specific integer value as its output.
Google Chrome Tips & 3
Tricks
Best IoT Edge Devices - Develop
Your App at the EdgeNetworking 3
Fundamental
Ad Our multiple protocol gateways are open to
Ad support edge computing and programmable.
MikroTik Tools 3
Routing Configuration 1
PCC first feeds selected fields (src-address, dst-address, src-port, dst-port or
WiFi Configuration 1
any combination of these) from IP header to hash function and with the help
WiFi Repeater 1
of hashing algorithm converts selected fields into 32 bit integer value and
Configuation
divides the integer value with a given integer number and then marks any
connection according to the remainder value. For example, the hash function
is fed 1.1.1.1 as the source IP address, 10000 as the source TCP port, 2.2.2.2 as
the destination IP address and 80 as the destination TCP port. The output will
VLAN Routing
be 1+1+1+1+10000+2+2+2+2+80 = 10092. PCC now divides this output with Configuration
a given integer value (if Dual WAN, integer value will be 2) and then marks between Mikr
connection according the remainder value such as if remainder is 0, RouterOS
connection is marked as 1st connection and if remainder is 1, connection is MikroTik
Configuration
marked as 2nd connection.
PPPoE WAN
PCC itself has absolutely nothing to do with routing, routing marks or
Connection
spreading load. PCC is simply a way to match packets and to mark packets. MikroTik VPN
Configuration
Routing decision is taken by Policy Routing according to marked packet.
Site-to-Site PP
The following three rules and their explanation will show PCC packet marking
more easily.
MikroTik ECM
Load Balancin
and Link
Redundancy
/ip firewall mangle add chain=prerouting action=mark-connection \new-
connection-mark=1st_conn per-connection-classifier=src-address-and- MikroTik Firew
Basic Concept
port:3/0
The first line means produce the output of the hash function given the packet’s
source IP address and port, divide it by 3 and if the remainder is 0, perform
the action of marking the connection as 1st_conn. The second line means
produce the output of the hash function given the packet’s source IP address
and port, divide it by 3 and if the remainder is 1, perform the action of
marking the connection as 2nd_conn. Similarly, the third line means produce
the output of the hash function given the packet’s source IP address and port,
divide it by 3 and if the remainder is 2, perform the action of marking the
connection as 3rd_conn.
SPONSORED SEARCHES
/ ip address
MikroTik Router basic configuration has been completed. Now we will create
Mangle rule to mark connection and routing.
new-connection-mark=ISP1_conn
new-connection-mark=ISP2_conn
per-connection-classifier=both-addresses:2/0 action=mark-connection
new-connection-mark=ISP1_conn
per-connection-classifier=both-addresses:2/1 action=mark-connection
new-connection-mark=ISP2_conn
new-routing-mark=to_ISP1
new-routing-mark=to_ISP2
dusuniot.com OPEN
NAT configuration as well as all our configurations for PCC Load Balancing
and Link Redundancy has been completed. Now LAN user will get
uninterrupted internet connection until both ISP connection is lost.
Follow the below video about MikroTik PCC Load Balancing and Link
Redundancy if you face any confusion to follow the steps. I hope it will reduce
your any confusion.
OPEN
ABU SAYEED
I am a system administrator and like to share knowledge that I
am learning from my daily experience. I usually work on
MikroTik, Redhat/CentOS Linux, Windows Server, physical
server and storage, virtual technology and other system related topics. Follow
Me: Facebook, Twitter and Linkedin.
Your name can also be listed here. Have an IT topic?
Submit it here to become a System Zone author.
21 comments
Captor
May 28, 2018 at 7:41 pm
Thanks for great sharing .You are doing a great job for us .
Br,
captor
Reply
Wawrzyniec Jakuczun
July 16, 2018 at 6:45 pm
Dear Sayeed,
It is very interesting article, other are also. I’ve did step by step but I’ve
failed. I’ve no internet connection, and don’t know what is wrong.
I’d used hAP lite RB951 with 6,42 RouterOS, or RB962 with 6,42
RouterOS. I’ve go two ISP: one is radioline ISP, second is LTE gate
(Huawei 5186 with HuigateOS). Separately both work perfectly – with
autoconfig from Mikrotik.
Trying to bond it – I’ve failed.
Can You give me any suggestions?
Reply
Sayeed
August 2, 2018 at 2:38 pm
Reply
siddhesh
September 13, 2018 at 4:09 pm
Reply
Sayeed
September 13, 2018 at 11:00 pm
Video is embedded with this article. Youtube link is
also there.
Reply
ibrahim
October 31, 2018 at 8:08 am
hi,
The problem is when link to gateway y.y.y. down or isp down, mikrotik
still doing nat to the gateway.
If im doing this nat below, i can do a failover but manualy, by disable the
down isp and clear the connection.
Thx.
Reply
Sayeed
November 1, 2018 at 9:18 am
Reply
Axel
March 4, 2019 at 8:26 pm
Hello there!
I have to different ISPs. For examle 194.29.62.118/24 gateway 194.29.62.1
– ISP1, 194.187.104.150/30 gateway 194.187.104.148 – ISP2. Both of
them are static IPs. I need to make them work together balancing the
output traffic. Both ISPs have 50Mbs speed. ISP1 connected to ether1,
ISP2 connected to ether2, I can’t figure out how to make them work
together on RB951G-2Hnd. Everything seemed to work fine following the
configuration instruction founded in the Internet. BUT, I have an outside
connection to ISP1 port 10000 that needs to be forwarded to local
machine 192.168.88.100 on RDP port 4000. How to make all of that stuff
working fine?
Reply
Axel
March 4, 2019 at 8:35 pm
Reply
Sayeed
March 6, 2019 at 12:16 am
Reply
ElTRiC
March 6, 2019 at 7:17 pm
Hello Sayeed,
Thanks a lot for sharing your work and tutorials.
I have two ISP, hAP lite router and 10/15 network clients.
I’ve tried load balancing via ECMP but had a lot of timeout errors,
cerificate and so but load balancing was working, bot ISP were used to
access to Internet.
Now since you’re telling that PCC works better I’ve tried it as well. But
even after triple checking my configuration, failover works nicely but load
balancing not at all, isp1 (wan_dsl) has full throttle and isp2 (wan_4G)
isn’t used at all
http://prntscr.com/mu27ce
I’ve also tried to apply unequal wan via PCC, same results…
What do you think is happening here ?
Reply
Sayeed
March 9, 2019 at 9:28 am
Reply
HAJJI
March 24, 2019 at 2:45 pm
Reply
Kashif Ali
July 24, 2019 at 1:33 pm
Reply
Chanda
June 19, 2019 at 6:05 pm
Hello,
Reply
Kashif Ali
July 24, 2019 at 1:30 pm
Dear Sayed,
Can i route specific User IP address to Specific ISP when load balance?
Reply
Abu Sayeed
July 24, 2019 at 4:23 pm
Reply
silverdr
August 30, 2019 at 7:03 pm
Hi, and thank you for this step by step guide. I especially liked the
inclusion of CLI commands. Have a question though. I got things running
but I don’t see a proper load balancing. Most (if not all) traffic goes
through the first interface and only if I disconnect it then the other one
takes over. Is there a way to fix this somehow so that the total throughput
comes closer to the sum of each interface is capable of?
Reply
Abu Sayeed
August 30, 2019 at 11:18 pm
Reply
silverdr
September 2, 2019 at 2:13 pm
Thank you for your response. From what I see is that the
routes without routing mark in their definitions (the
“failover” ones) take precedence over those, with routing
mark and since the second one has larger distance, the first
it is the “preferred” one where all the traffic goes.
Reply
silverdr
September 2, 2019 at 3:59 pm
Reply
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
CAPTCHA Code
*
Post Comment
This site uses Akismet to reduce spam. Learn how your comment data is
processed.
Home Networking MikroTik Router Tips & Tricks About System Zone Contact Sitemap
Terms of Use Privacy Policy
System Zone Copyright © 2019