How to use different types of PCC load balancing?

I want to use “both-addresses” type of load balancing for TCP 80 and 443.
others use “both-addresses and ports” type of load balancing.
But it seems my settings are incorrect, please help me check it
Thanks :open_mouth:

add action=mark-connection chain=input disabled=no in-interface=pppoe-out1 \
    new-connection-mark=pppoe-out1_conn passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out1_conn \
    disabled=no new-routing-mark=to_pppoe-out1 passthrough=yes

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out1_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/0 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out1_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/0

add action=mark-routing chain=prerouting connection-mark=pppoe-out1_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out1 \
    passthrough=yes

where are your 5 lines?..

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=\
    pppoe-out1_conn passthrough=yes per-connection-classifier=\
    both-addresses-and-ports:2/0

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=\
    pppoe-out2_conn passthrough=yes per-connection-classifier=\
    both-addresses-and-ports:2/1



add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out1_conn passthrough=yes per-connection-classifier=\
    both-addresses:2/0 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out2_conn passthrough=yes per-connection-classifier=\
    both-addresses:2/1 protocol=tcp



add action=mark-routing chain=prerouting connection-mark=pppoe-out1_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out1 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out2_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out2 \
    passthrough=yes

Thanks Chupaka :slight_smile:
and yes,5-lines
捕获.PNG

So do you have four more pairs of lines for 5/1 - 5/4?

Can you show your entire PCC configuration?

Hi fewi :slight_smile:
Yes,i have four more pairs of lines for 5/1 - 5/4. too long, I have not put up.

/ip firewall mangle
add action=mark-connection chain=input disabled=no in-interface=pppoe-out1 \
    new-connection-mark=pppoe-out1_conn passthrough=yes 

add action=mark-connection chain=input disabled=no in-interface=pppoe-out2 \
    new-connection-mark=pppoe-out2_conn passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out3 \
    new-connection-mark=pppoe-out3_conn passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out4 \
    new-connection-mark=pppoe-out4_conn passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out5 \
    new-connection-mark=pppoe-out5_conn passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out1_conn \
    disabled=no new-routing-mark=to_pppoe-out1 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out2_conn \
    disabled=no new-routing-mark=to_pppoe-out2 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out3_conn \
    disabled=no new-routing-mark=to_pppoe-out3 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out4_conn \
    disabled=no new-routing-mark=to_pppoe-out4 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out5_conn \
    disabled=no new-routing-mark=to_pppoe-out5 passthrough=yes

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out1_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/0 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out2_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/1 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out3_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/2 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out4_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/3 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out5_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/4 protocol=tcp

add action=mark-routing chain=prerouting connection-mark=pppoe-out1_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out1 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out2_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out2 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out3_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out3 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out4_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out4 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out5_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out5 \
    passthrough=yes

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out1_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/0

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out2_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/1

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out3_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/2

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out4_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/3

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out5_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/4

捕获1.PNG

If that’s the order you have them in it won’t work. You have to have all the rules with mark-connection above the rules that have an action of mark-routing.

The mark-routing rules set the actual routing mark that lead to PCC load balancing for you. In your case, you’re setting connection marks for non HTTP(S) traffic after you have already set routing marks, so that doesn’t work and leads to all kind of problems with packets further down the flow going out the wrong gateway.

Move the rules and try again, and please do post your final result and working ruleset as I am sure lots of people will be looking this up.

Thanks fewi :slight_smile:
I tried, it works fine.
I always thought “BOTH-ADDRESSRE” type of load balancing rules should be placed at the top, I was wrong.
But I still have some questions I need your guidance ,I found that the removal of INPUT and OUTPUT, it also work.They are necessary?
and I will post my final result and working ruleset.
捕获2.PNG

Yes, they also are needed, otherwise you are going to have problems with traffic going from and to the router. It fixed your immediate issue, but would have created new ones.

Thanks again :smiley:

/ip firewall mangle
add action=mark-connection chain=input disabled=no in-interface=pppoe-out1 \
    new-connection-mark=pppoe-out1_conn passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out2 \
    new-connection-mark=pppoe-out2_conn passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out3 \
    new-connection-mark=pppoe-out3_conn passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out4 \
    new-connection-mark=pppoe-out4_conn passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out5 \
    new-connection-mark=pppoe-out5_conn passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out1_conn \
    disabled=no new-routing-mark=to_pppoe-out1 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out2_conn \
    disabled=no new-routing-mark=to_pppoe-out2 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out3_conn \
    disabled=no new-routing-mark=to_pppoe-out3 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out4_conn \
    disabled=no new-routing-mark=to_pppoe-out4 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out5_conn \
    disabled=no new-routing-mark=to_pppoe-out5 passthrough=yes

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out1_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/0

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out2_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/1

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out3_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/2

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out4_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/3

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local in-interface=LAN-1 new-connection-mark=pppoe-out5_conn \
    passthrough=yes per-connection-classifier=both-addresses-and-ports:5/4

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out1_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/0 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out2_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/1 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out3_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/2 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out4_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/3 protocol=tcp

add action=mark-connection chain=prerouting disabled=no dst-address-type=\
    !local dst-port=80,443 in-interface=LAN-1 new-connection-mark=\
    pppoe-out5_conn passthrough=yes per-connection-classifier=\
    both-addresses:5/4 protocol=tcp

add action=mark-routing chain=prerouting connection-mark=pppoe-out1_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out1 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out2_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out2 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out3_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out3 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out4_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out4 \
    passthrough=yes

add action=mark-routing chain=prerouting connection-mark=pppoe-out5_conn \
    disabled=no in-interface=LAN-1 new-routing-mark=to_pppoe-out5 \
    passthrough=yes

捕获3.PNG