Community discussions

MikroTik App
 
User avatar
fengyuclub
Member Candidate
Member Candidate
Topic Author
Posts: 109
Joined: Mon Dec 09, 2013 8:50 am

need help about a script

Mon Dec 26, 2016 10:42 am

Read some topic, the perfect solution to my problem.http://forum.mikrotik.com/viewtopic.php?f=9&t=111627
:local oldip [/ip firewall address-list get [find list="xxxxxip"] address];
:local newip [/ip address get [find interface="adsl"] address];
:local newip [:pick $newip 0 [:find $newip "/"]];

:if ($newip != $oldip) do={    
    /ip firewall nat remove [find comment~"^upnp.*"];
    :put "ip address $old changed to $newip";
    /ip firewall address-list set [find list="xxxxxip"] address=$newip
:delay 2s
    /ip upnp set enabled=no
:delay 3s
    /ip upnp set enabled=yes
:delay 3s
    :put "Sending e-mail.";
 /tool e-mail send \
        to="xxx@xxx.com" \
        subject=("$[/system identity get name] xxxxx IP address change") \
        body=("xxxxx IP address has just been changed:\n\nOld: " . $oldip . "\nNew: " . $newip);
}
Although the mail can remind me ip address changes, but in the end want to achieve the effect is fixed Internet dial-up from the IP address, the following script how to change the adsl link ip can change, continue dialing until the ip The address is the same as before, and dialing stops. That would be great, if you add the appropriate judgments, to get results?
/interface pppoe-client disable adsl
:delay 1s
/interface pppoe-client enable adsl
I will use these statements, but do not know how to join the judgment to stop dialing.


Please forgive my English, I am from China. These are all from the Google translation help.
 
User avatar
fengyuclub
Member Candidate
Member Candidate
Topic Author
Posts: 109
Joined: Mon Dec 09, 2013 8:50 am

Re: need help about a script

Tue Dec 27, 2016 9:51 am

:?:
 
User avatar
fengyuclub
Member Candidate
Member Candidate
Topic Author
Posts: 109
Joined: Mon Dec 09, 2013 8:50 am

Re: need help about a script

Wed Jan 04, 2017 9:13 am

helpme