local index 0
local ppplen
:set ppplen  [len [/ip address find  interface~"pppoe"]]

:foreach m in=([/interface pppoe-client find running=yes]) do={
	:local pinterface [/interface pppoe-client get $m interface ]
	:local pname [/interface pppoe-client get $m name ]
	
	#pcc

	#makeconnection

	local internum ($index+1)
	local connmark "wan$internum_conn"
	local routemark "to_wan$internum"		
	local classifier "both-addresses-and-ports:$ppplen/$index"

	/ip fir ma

	:log info $classifier

	add action=mark-connection chain=prerouting dst-address-type=!local 
		in-interface=bridge-local new-connection-mark=$connmark 
		per-connection-classifier=$classifier src-address=10.0.0.0/8
		
	#makerouting

	add action=mark-routing chain=prerouting connection-mark=$connmark 
		in-interface=bridge-local new-routing-mark=$routemark src-address=10.0.0.0/8
		
		
	#input
	add action=mark-connection chain=input in-interface=$pname 
		new-connection-mark=$connmark

	#output
	add action=mark-routing chain=output connection-mark=$connmark 
		new-routing-mark=$routemark
		
	#router
	/ip route
	add check-gateway=ping distance=1 gateway=$pname routing-mark=$routemark

	add check-gateway=ping distance=($index+1) gateway=$pname


	#index++

	:set index ($index+1)
}

教程收集自网络

发表回复

后才能评论