Page 1 of 1

Using PCC more efficient

Posted: Wed Aug 30, 2023 10:12 pm
by msatter
I see often PCC being defined for every part that should be separated. I see the following lines for example 25% for one gateway and 75% for the second gateway.

Then I see these kind of PCC rules:

PCC line 1: pcc 4/0 ==> connection mark gateway-25 if not already connection marked
PCC line 2: pcc 4/1 ==> connection mark gateway-75 if not already connection marked
PCC line 3: pcc 4/2 ==> connection mark gateway-75 if not already connection marked
PCC line 4: pcc 4/3 ==> connection mark gateway-75 if not already connection marked

Connections now gets split in one part for gateway-25 and three parts for gateway-75 making in total 100%

In fact splitting the connections in two parts. One of 25% and one of 75%. If you want to have a 75% part then you can subtract 25% from 100% and you are left with 75%.

Why not apply that that also to PCC? The lines will be then like this and the strike-trough lines can be omitted in the final version of course.

PCC line 1: pcc 4/0 ==> connection mark gateway-25 if not already connection marked
PCC line 2: pcc 4/1 ==> connection mark gateway-75 if not already connection marked
PCC line 3: pcc 4/2 ==> connection mark gateway-75 if not already connection marked
PCC line 3: pcc 4/3 ==> connection mark gateway-75 if not already connection marked
Traffic not already connection marked ==> gateway-75

You are now having the same result by replacing three lines by one line. That line marks the traffic not yet marked by the pcc 4/0 line which is the remainder of 75%.

Re: Using PCC more efficient

Posted: Wed Aug 30, 2023 10:50 pm
by anav
I will bite, so where will that 75% of traffic get routed then?? If not assigned to specific WAN, (lets say there are three) ?????
Even if there are two gateways, you haven't funnelled that traffic to gateway75, it still may go to gateway 25.
It will depend, I think, what you have setup on the main table, (aka distance for example).......

Edit: After the post below, clued-in, the non-marked traffic does get routed............ So yes very nice!

Re: Using PCC more efficient

Posted: Thu Aug 31, 2023 5:02 pm
by arnaldo
The concept is great!
But there is an error in the post (probably resulting from cut-paste) is that the second example still has PCC lines 2 to 4.

so the correct rules would be (assumes that all packets start as not conn-marked):

PCC 4/0 ===> connection mark gateway-25
if not marked ==> connection mark to gateway-75

This is very interesting, specially with ratios that require several rules, like 3:7. Instead of 10 rules, one can use just 4, a 60% improvement. Nice!

Re: Using PCC more efficient

Posted: Thu Aug 31, 2023 10:32 pm
by msatter
The concept is great!
But there is an error in the post (probably resulting from cut-paste) is that the second example still has PCC lines 2 to 4.

so the correct rules would be (assumes that all packets start as not conn-marked):

PCC 4/0 ===> connection mark gateway-25
if not marked ==> connection mark to gateway-75

This is very interesting, specially with ratios that require several rules, like 3:7. Instead of 10 rules, one can use just 4, a 60% improvement. Nice!
Those lines are left there on purpose to show what can be made obsolete. I did write that also in my post.

"The lines will be then like this and the strike-trough lines can be omitted in the final version of course."

Re: Using PCC more efficient

Posted: Sun Sep 10, 2023 1:42 pm
by kashifmax
The concept is great!
But there is an error in the post (probably resulting from cut-paste) is that the second example still has PCC lines 2 to 4.

so the correct rules would be (assumes that all packets start as not conn-marked):

PCC 4/0 ===> connection mark gateway-25
if not marked ==> connection mark to gateway-75

This is very interesting, specially with ratios that require several rules, like 3:7. Instead of 10 rules, one can use just 4, a 60% improvement. Nice!
Those lines are left there on purpose to show what can be made obsolete. I did write that also in my post.

"The lines will be then like this and the strike-trough lines can be omitted in the final version of course."
Hi,
Thanks for the tip so how to convert this as per yours
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local in-interface=ether5_lan new-connection-mark=wan1_conn passthrough=yes per-connection-classifier=both-addresses-port:3/0

add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local in-interface=ether5_lan new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=both-addresses-port:3/1

add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local in-interface=ether5_lan new-connection-mark=wan3_conn passthrough=yes per-connection-classifier=both-addresses-port:3/2
And I think no need if 2 WAN lines.

Thank you