马上注册成为ROSABC会员,随时发帖回复。
您需要 登录 才可以下载或查看,没有账号?会员注册
x
/interface set [/interface find name=ether1] name=wan1
/interface set [/interface find name=ether2] name=wan2
/interface set [/interface find name=ether3] name=lan
/interface pppoe-client add name="pppoe-out1" max-mtu=1480 max-mru=1480 interface=wan1 user="user" password="1234" profile=default service-name="" ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no
/interface pppoe-client add name="pppoe-out2" max-mtu=1480 max-mru=1480 interface=wan2 user="user2" password="1234" profile=default service-name="" ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no
/ip address add address=10.111.1.1/24 comment=1 interface=pppoe-out1
/ip address add address=10.112.1.1/24 comment=2 interface=pppoe-out2
/ip address add address=192.168.1.1/24 interface=lan
/system scheduler add name=schedule2 on-event=":global assignrn:global newrn:global statusrn:global xrn:global linkrn:set x 2rn:set link 3rn:for i from=1 to=$x do={rn :set status [/interface get [/interface find name=("pppoe-out" . $i)] running]rn :if ($status=true) do={rn :set new [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]rn :set new [:pick $new 0 ([:len $new] -3)]rn :set assign [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]rn :set assign [:pick $assign 0 ([:len $assign] -3)]rn :if ($assign != $new) do={ /ip address set [/ip address find comment=$i] address=$new network=$new broadcast=$newrn /ip fir nat set [/ip fir nat find comment=$i] to-addresses=$newrn /ip route set [/ip route find comment=$i] gateway=$newrn :if ($i=1) do={/ip route set [/ip route find comment=$link] gateway=$new}rn }rn }rn}rn" interval=5
/ip route add dst-address=0.0.0.0/0 gateway=10.111.0.1 routing-mark=1 comment=1 disabled=no
/ip route add dst-address=0.0.0.0/0 gateway=10.112.0.1 routing-mark=2 comment=2 disabled=no
/ip route add dst-address=0.0.0.0/0 gateway=10.111.0.1 comment=3 disabled=no
/ip firewall nat add chain=srcnat action=masquerade out-interface=pppoe-out1
/ip firewall nat add chain=srcnat action=masquerade out-interface=pppoe-out2
/ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark=1 passthrough=yes connection-state=new src-address=192.168.1.2-192.168.1.254 nth=2,1
/ip firewall mangle add chain=prerouting action=mark-routing new-routing-mark=1 passthrough=yes src-address=192.168.1.2-192.168.1.254 connection-mark=1
/ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark=2 passthrough=yes connection-state=new src-address=192.168.1.2-192.168.1.254 nth=2,2
/ip firewall mangle add chain=prerouting action=mark-routing new-routing-mark=2 passthrough=yes src-address=192.168.1.2-192.168.1.254 connection-mark=2 |