Community discussions

MikroTik App
 
sadeghnakhjavani
just joined
Topic Author
Posts: 6
Joined: Wed Jan 08, 2014 10:50 am

Problem with PCC Load Balancing !!!

Tue Jan 14, 2014 2:20 pm

Hi and Thank you for this post
I have tow problems with PCC.
We have 4 unequal WAN connection from different ISPs. I config our RB2011U for PCC loadBalancing according to the MikroTik website article (http://wiki.mikrotik.com/wiki/Manual:PCC) and everything is good.
But I have 2 questions :
How can I route the traffic of a specific host (192.168.1.50) from LAN to WAN1 link forever?
How can I force FTP traffic go through WAN2 link and use WAN3 link as failover link?
This is my config:
/interface
set name=LAN numbers=5
set name=WAN1 numbers=6
set name=WAN2 numbers=7
set name=WAN3 numbers=8
set name=WAN4 numbers=9

/ip address
add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=LAN
add address=10.10.10.1/29 network=10.10.10.0 broadcast=10.10.10.7 interface=WAN1
add address=10.10.20.1/29 network=10.10.20.0 broadcast=10.10.20.7 interface=WAN2
add address=10.10.30.1/29 network=10.10.30.0 broadcast=10.10.30.7 interface=WAN3
add address=10.10.40.1/29 network=10.10.40.0 broadcast=10.10.40.7 interface=WAN4

/ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_Connection
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_Connection 
add chain=input in-interface=WAN3 action=mark-connection new-connection-mark=WAN3_Connection 
add chain=input in-interface=WAN4 action=mark-connection new-connection-mark=WAN4_Connection 

add chain=output connection-mark=WAN1_Connection action=mark-routing new-routing-mark=Route_To_WAN1 
add chain=output connection-mark=WAN2_Connection action=mark-routing new-routing-mark=Route_To_WAN2 
add chain=output connection-mark=WAN3_Connection action=mark-routing new-routing-mark=Route_To_WAN3 
add chain=output connection-mark=WAN4_Connection action=mark-routing new-routing-mark=Route_To_WAN4 

add chain=prerouting in-interface=LAN dst-address=10.10.20.0/29 action=accept 
add chain=prerouting in-interface=LAN dst-address=10.10.30.0/29 action=accept
add chain=prerouting in-interface=LAN dst-address=10.10.40.0/29 action=accept 
add chain=prerouting in-interface=LAN dst-address=10.10.50.0/29 action=accept 

add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/0 action=mark-connection new-connection-mark=WAN1_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/1 action=mark-connection new-connection-mark=WAN1_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/2 action=mark-connection new-connection-mark=WAN1_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/3 action=mark-connection new-connection-mark=WAN1_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/4 action=mark-connection new-connection-mark=WAN2_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/5 action=mark-connection new-connection-mark=WAN2_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/6 action=mark-connection new-connection-mark=WAN2_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/7 action=mark-connection new-connection-mark=WAN2_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/8 action=mark-connection new-connection-mark=WAN3_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/9 action=mark-connection new-connection-mark=WAN3_Connection passthrough=yes 
add chain=prerouting dst-address-type=!local in-interface=LAN per-connection-classifier=both-addresses-and-ports:11/10 action=mark-connection new-connection-mark=WAN4_Connection passthrough=yes

add chain=prerouting connection-mark=WAN1_Connection in-interface=LAN action=mark-routing new-routing-mark=Route_To_WAN1
add chain=prerouting connection-mark=WAN2_Connection in-interface=LAN action=mark-routing new-routing-mark=Route_To_WAN2
add chain=prerouting connection-mark=WAN3_Connection in-interface=LAN action=mark-routing new-routing-mark=Route_To_WAN3
add chain=prerouting connection-mark=WAN4_Connection in-interface=LAN action=mark-routing new-routing-mark=Route_To_WAN4

/ip route
add dst-address=0.0.0.0/0 routing-mark=Route_To_WAN1 gateway=10.10.10.6 check-gateway=ping 
add dst-address=0.0.0.0/0 routing-mark=Route_To_WAN2 gateway=10.10.20.6 check-gateway=ping
add dst-address=0.0.0.0/0 routing-mark=Route_To_WAN3 gateway=10.10.30.6 check-gateway=ping 
add dst-address=0.0.0.0/0 routing-mark=Route_To_WAN4 gateway=10.10.40.6 check-gateway=ping 

add dst-address=0.0.0.0/0 gateway=10.10.10.6 distance=1 check-gateway=ping 
add dst-address=0.0.0.0/0 gateway=10.10.20.6 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.10.30.6 distance=3 check-gateway=ping 
add dst-address=0.0.0.0/0 gateway=10.10.40.6 distance=4 check-gateway=ping 

/ip firewall nat
add chain=srcnat out-interface=WAN1 action=masquerade
add chain=srcnat out-interface=WAN2 action=masquerade
add chain=srcnat out-interface=WAN3 action=masquerade
add chain=srcnat out-interface=WAN4 action=masquerade[code2=ros][/code2]
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Problem with PCC Load Balancing !!!

Tue Jan 14, 2014 3:45 pm

Hi.
For routing a ip through a specific wan first you need mark route from this ip in mangle and then set the gateway in routes.

For the ftp is the same but with tcp protocol and dst port 20,21 and in the route set the gateway wan2 with distance 1 and other route with wan3 but with distance 2

Both mangle rules put in the top of your rules



Send from my mobile phone using Tapatalk.
 
onowojemma
Member Candidate
Member Candidate
Posts: 129
Joined: Sun Sep 11, 2005 5:27 pm
Location: Nigeria

Re: Problem with PCC Load Balancing !!!

Sat May 31, 2014 7:43 am

Hi thanks for this great post, please i have one question my what if the two gateway are up but a hop in one of the ISP to the internet is down how would my router know that ISP A has no route to the internet
kind regards
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: Problem with PCC Load Balancing !!!

Sat May 31, 2014 1:51 pm

You have to check it by script and correct the routing if the gw does not have connection out.
 
onowojemma
Member Candidate
Member Candidate
Posts: 129
Joined: Sun Sep 11, 2005 5:27 pm
Location: Nigeria

Re: Problem with PCC Load Balancing !!!

Sat May 31, 2014 4:36 pm

Thanks please can you help me with the script and I also want Vpn traffic to go out through Isp A
Kind regards

Who is online

Users browsing this forum: Partial and 103 guests