/ip firewall mangle
add chain=input in-interface=pppoe-assim connection-mark=no-mark action=mark-connection new-connection-mark=link1_to_ros
add chain=input in-interface=pppoe-out1 connection-mark=no-mark action=mark-connection new-connection-mark=link2_to_ros
add chain=input in-interface=pppoe-out2 connection-mark=no-mark action=mark-connection new-connection-mark=link3_to_ros
add chain=output connection-mark=link1_to_ros action=mark-routing new-routing-mark=link1_routing
add chain=output connection-mark=link2_to_ros action=mark-routing new-routing-mark=link2_routing
add chain=output connection-mark=link3_to_ros action=mark-routing new-routing-mark=link3_routing
add chain=forward in-interface=pppoe-assim connection-mark=no-mark action=mark-connection new-connection-mark=from_link1
add chain=forward in-interface=pppoe-out1 connection-mark=no-mark action=mark-connection new-connection-mark=from_link2
add chain=forward in-interface=pppoe-out2 connection-mark=no-mark action=mark-connection new-connection-mark=from_link3
add chain=prerouting connection-mark=from_link1 action=mark-routing new-routing-mark=link1_routing
add chain=prerouting connection-mark=from_link2 action=mark-routing new-routing-mark=link2_routing
add chain=prerouting connection-mark=from_link3 action=mark-routing new-routing-mark=link3_routing
add chain=prerouting connection-mark=no-mark dst-address-type=!local new-connection-mark=lan_to_wan
add chain=prerouting connection-mark=lan_to_wan per-connection-classifier=both-addresses-and-ports:3/0 action=mark-routing new-connection-mark=link1_routing
add chain=prerouting connection-mark=lan_to_wan per-connection-classifier=both-addresses-and-ports:3/1 action=mark-routing new-connection-mark=link2_routing
add chain=prerouting connection-mark=lan_to_wan per-connection-classifier=both-addresses-and-ports:3/2 action=mark-routing new-connection-mark=link3_routing
add chain=prerouting connection-mark=lan_to_wan routing-mark=link1_routing action=mark-connection new-connection-mark=sticky_to_link1
add chain=prerouting connection-mark=lan_to_wan routing-mark=link2_routing action=mark-connection new-connection-mark=sticky_to_link2
add chain=prerouting connection-mark=lan_to_wan routing-mark=link3_routing action=mark-connection new-connection-mark=sticky_to_link3
add chain=prerouting connection-mark=sticky_to_link1 new-routing-mark=link1_routing
add chain=prerouting connection-mark=sticky_to_link2 new-routing-mark=link2_routing
add chain=prerouting connection-mark=sticky_to_link3 new-routing-mark=link3_routing