标准3线PCC

/ip firewall mangle
add action=mark-connection chain=input comment=From_ADSL1 dst-address-type="" in-interface=pppoe-out1 new-connection-mark=adsl1_conn passthrough=yes src-address-type=""
add action=mark-routing chain=output comment=To_ADSL1 connection-mark=adsl1_conn new-routing-mark=to_adsl1 passthrough=yes
add action=mark-connection chain=prerouting comment=pcc_1 connection-state=new dst-address-type=!local new-connection-mark=adsl1_conn passthrough=yes \
    per-connection-classifier=both-addresses:3/0 src-address-list=lan
add action=mark-routing chain=prerouting connection-mark=adsl1_conn new-routing-mark=to_adsl1 passthrough=yes src-address-list=lan
add action=mark-connection chain=input comment=From_ADSL2 in-interface=pppoe-out2 new-connection-mark=adsl2_conn passthrough=yes
add action=mark-routing chain=output comment=To_ADSL2 connection-mark=adsl2_conn new-routing-mark=to_adsl2 passthrough=yes
add action=mark-connection chain=prerouting comment=pcc_2 connection-state=new dst-address-type=!local new-connection-mark=adsl2_conn passthrough=yes \
    per-connection-classifier=both-addresses:3/1 src-address-list=lan
add action=mark-routing chain=prerouting connection-mark=adsl2_conn new-routing-mark=to_adsl2 passthrough=yes src-address-list=lan
add action=mark-connection chain=input comment=From_ADSL3 in-interface=pppoe-out3 new-connection-mark=adsl3_conn passthrough=yes
add action=mark-routing chain=output comment=To_ADSL3 connection-mark=adsl3_conn new-routing-mark=to_adsl3 passthrough=yes
add action=mark-connection chain=prerouting comment=pcc_3 connection-state=new dst-address-type=!local new-connection-mark=adsl3_conn passthrough=yes \
    per-connection-classifier=both-addresses:3/2 src-address-list=lan
add action=mark-routing chain=prerouting connection-mark=adsl3_conn new-routing-mark=to_adsl3 passthrough=yes src-address-list=lan
========脚本=============

{
:local status
:local i "22"
:local x "0"
:local y "0"
:local z "0"
:set x [:len [/interface pppoe-client find running=yes]]
:if ($x<$i) do={
:for ii from=1 to=$i do={
:set status [/interface get [find name=("yd-out".$ii)] running]
:if ($status=true) do={
/ip firewall mangle set [find new-connection-mark="$ii-conn"] per-connection-classifier=("both-addresses-and-ports:".$x."/".$y) disable=no;:set y ($y+1)} else={
/ip firewall mangle set [find new-connection-mark="$ii-conn"] disable=yes}}}
:if ($x=$i) do={
:set z [:len [/ip firewall mangle find action="mark-connection" disabled=yes chain=prerouting]]
:if ($z>0) do={
:for ii from=1 to=$i do={
/ip firewall mangle set [find new-connection-mark="$ii-conn"] per-connection-classifier=("both-addresses-and-ports:".$x."/".$y) disable=no;:set y ($y+1)}}}}

你可能感兴趣的:(标准3线PCC)