標題:
Send e-mail for any change in WAN IP (public or private)
[打印本頁]
作者:
角色
時間:
2018-5-14 19:34
標題:
Send e-mail for any change in WAN IP (public or private)
因为大陆有很多地方都用private IP,但是private IP很多DNS都提供支持,我接的以前好像DynDNS是支持的。我记得RouterOS好像有script,如果IP有变动,可以send script,群里的某位member都有这样的script,不知道是否可以share出来呢?
主要用途,链接RB后面的Asterisk Server。
谢谢!
作者:
角色
時間:
2018-5-14 19:49
找到一个
:local oldip [/ip firewall address-list get [find list="externalip"] address];
:local newip [/ip address get [find interface="ether1"] address];
:local newip [:pick $newip 0 [:find $newip "/"]];
:if ($newip != $oldip) do={
:put "ip address $old changed to $newip";
/ip firewall address-list set [find list="externalip"] address=$newip
:put "Sending e-mail.";
/tool e-mail send \
to="someone@somewhere.com" \
subject=("$[/system identity get name] Ether1 address change") \
body=("Your Ether1 address has just been changed:\n\nOld: " . $oldip . "\nNew: " . $newip);
}
複製代碼
作者:
gfx86674
時間:
2018-5-16 01:28
1.設定外寄信箱(區分POP3與Gmail信箱兩種設置,端看您個人環境):
POP3信箱(以Hinet個人信箱為例):
Gmail信箱:
DHCP-Clinet置入script:
:global public ; :local current
:if ([:len $public]=0) do={:set public "\?\?\?"}
:if ($bound=1) do={:set current [/ip dhcp-c get [find interface=$interface] address] ; :set current [:pick $current 0 [:find $current "/"]]}
:if ($bound=1 && $current!=$public) do={
:local online false
:while (!$online) do={
:do {
/tool e-mail send to=[/tool e-mail get from] subject="Current Address: $public => $current" body="Current Address: $current"
:set online true ; :delay 5s} on-error={:delay 3s}}
:set public $current
}
複製代碼
歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/)
Powered by Discuz! 7.2