Code: Select all
: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);
}
Code: Select all
/interface pppoe-client disable adsl
:delay 1s
/interface pppoe-client enable adsl
Please forgive my English, I am from China. These are all from the Google translation help.