Can anybody help my script about auto change the pppoe IP

Hello every one in here:

I got a fix ip and a pppoe ip from my ISP.

I build a soure ip route to use them.

But the pppoe IP will change when the MT reboot.

So I write a script about it, but it can not work

Can any body help me?

:global ppp_stat1
:global ppp_network1
:global ppp_network2
/interface pppoe-client monitor pppoe-out1 once do={:set ppp_stat1 $status}
:if ($ppp_stat1=“connected”) do={
:set ppp_network1 [/ip address get [/ip add find interface=pppoe-out1] network]
:if ($ppp_network1!=$ppp_network2) do={
:set network2 $network1
/ip rou
set [/ip rou find comment=ppp] gateway=$network2
}
}


any wrong in it???

I change it in noon

:global ppp_network1
:global ppp_network2
:if ([/interface pppoe-out1 get [find name=pppoe-out1] running]=true) do {
:set ppp_network1 [/ip address get [/ip add find interface=pppoe-out1] network]
:set ppp_network2 [/ip route get [find comment=ppp] gateway]
:if ($ppp_network1 != $ppp_network2) do {
:set network2 $network1
/ip route set [find comment=ppp] gateway=$network2
}
}


still not work

source ip route?
you mean source ip nat?
Did you tried “masquerade”?

I had got the answer for this case.

Simple and effect!

Will you share it with us ?