| Baris 1: | Baris 1: | ||
| − | Gunakan script berikut ini untuk supaya perangkat Mikrotik dapat melakukan update Dynamic DNS secara otomatis: | + | Gunakan salah satu script berikut ini untuk supaya perangkat Mikrotik dapat melakukan update Dynamic DNS secara otomatis: |
| + | |||
| + | == Alternatif Pertama == | ||
<source lang="text"> | <source lang="text"> | ||
| Baris 12: | Baris 14: | ||
# the name of interface that gets dynamic IP address | # the name of interface that gets dynamic IP address | ||
| − | :local dyndnsinterface " | + | :local dyndnsinterface "your interface" |
## do not modify after this line | ## do not modify after this line | ||
| Baris 26: | Baris 28: | ||
} | } | ||
} | } | ||
| + | } | ||
| + | </source> | ||
| + | |||
| + | == Alternatif Kedua == | ||
| + | |||
| + | Versi ini kompatibel untuk Mikrotik versi lama (3.x). | ||
| + | |||
| + | <source lang="text"> | ||
| + | ## Dynamic DNS script for indoglobal.com services | ||
| + | |||
| + | # User variables | ||
| + | :local dyndnsupdatehostname "mail.example.net" | ||
| + | :local dyndnsuser "username" | ||
| + | :local dyndnspass "password" | ||
| + | :local dyndnsinterface "interface" | ||
| + | |||
| + | # Get the current IP address | ||
| + | :local curip [ /ip address get [/ip address find interface=$dyndnsinterface ] address ] | ||
| + | |||
| + | # Strip the net mask | ||
| + | :for i from=( [:len $curip] - 1) to=0 do={ | ||
| + | :if ( [:pick $curip $i] = "/") do={ | ||
| + | :set curip [:pick $curip 0 $i] | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # Did we get an IP address to compare? | ||
| + | :if ([ :typeof $curip ] = nil ) do={ | ||
| + | :log info ("Dynamic DNS: No IP address present on " . $dyndnsinterface) | ||
| + | } else={ | ||
| + | :local dnsip [:resolve $dyndnsuser]; | ||
| + | :if ($curip != $dnsip) do={ | ||
| + | :log info ("Dynamic DNS: Sending update " . $dnsip) | ||
| + | /tool fetch address="dyndnsupdatehostname" src-path="nic/update\3Fhostname=$dyndnsuser&myip=$curip" user=$dyndnsuser password=$dyndnspass keep-result=no | ||
| + | } else={ | ||
| + | :log info "Dynamic DNS: No update required" | ||
| + | } | ||
} | } | ||
</source> | </source> | ||
[[Kategori:Subdomain]] | [[Kategori:Subdomain]] | ||
Gunakan salah satu script berikut ini untuk supaya perangkat Mikrotik dapat melakukan update Dynamic DNS secara otomatis:
## Dynamic DNS script for indoglobal.com service
## Script Settings
# get these from usage information in control panel
:local dyndnsupdateurl "http://mail.example.net/nic/update"
:local dyndnsuser "your username"
:local dyndnspass "your password"
# the name of interface that gets dynamic IP address
:local dyndnsinterface "your interface"
## do not modify after this line
:local dyndnsdomain "$dyndnsuser"
:local IpCurrent [/ip address get [find interface=$dyndnsinterface] address];
:for i from=( [:len $IpCurrent] - 1) to=0 do={
:if ( [:pick $IpCurrent $i] = "/") do={
:local NewIP [:pick $IpCurrent 0 $i];
:if ([:resolve $dyndnsdomain] != $NewIP) do={
/tool fetch mode=http user=$dyndnsuser password=$dyndnspass url="$dyndnsupdateurl\3Fhostname=$dyndnsdomain&myip=$NewIP" keep-result=no
:log info "Dynamic DNS Update: $dyndnsdomain - $NewIP"
}
}
}Versi ini kompatibel untuk Mikrotik versi lama (3.x).
## Dynamic DNS script for indoglobal.com services
# User variables
:local dyndnsupdatehostname "mail.example.net"
:local dyndnsuser "username"
:local dyndnspass "password"
:local dyndnsinterface "interface"
# Get the current IP address
:local curip [ /ip address get [/ip address find interface=$dyndnsinterface ] address ]
# Strip the net mask
:for i from=( [:len $curip] - 1) to=0 do={
:if ( [:pick $curip $i] = "/") do={
:set curip [:pick $curip 0 $i]
}
}
# Did we get an IP address to compare?
:if ([ :typeof $curip ] = nil ) do={
:log info ("Dynamic DNS: No IP address present on " . $dyndnsinterface)
} else={
:local dnsip [:resolve $dyndnsuser];
:if ($curip != $dnsip) do={
:log info ("Dynamic DNS: Sending update " . $dnsip)
/tool fetch address="dyndnsupdatehostname" src-path="nic/update\3Fhostname=$dyndnsuser&myip=$curip" user=$dyndnsuser password=$dyndnspass keep-result=no
} else={
:log info "Dynamic DNS: No update required"
}
}
Sosial
Facebook
Twitter
Google Plus
Temukan kami di Google+