WAN IP címének pingelése belső hálózatról


Első lépés: /interface bridge add name=lobridge

Második lépés: /ip address add address=172.17.1.200 network=172.17.1.200 interface=lobridge

Harmadik lépés: /system script add name="pub ip loopback"

Negyedik lépés: /system script edit "pub ip loopback" value-name=source

Ötödik lépés: A script beillesztése, majd nyomj ctrl+O-t

Hatodik lépés: /system scheduler add interval=01:00:00 start-time=startup on-event="pub ip loopback" name="pub ip loopback refresh"

A szkript:

#Script by: Sarkozi Adam
#Define loopback bridge
:local lointerface "lobridge"

#Define DDNS name
:local hostname [/ip cloud get dns-name]

#Get current WAN ip from bridge
:global currentIP [/ip address get [find interface="$lointerface" disabled=no] address]

#Update DDNS
/ip cloud force-update;
:delay 10s;

#Resolving DDNS
:global resolvedIP [:resolve $hostname]
:global resolvedIPwocidr  $resolvedIP
:global resolvedIP "$resolvedIP/32"

#IP changing process
:if ($currentIP != $resolvedIP) do={
:log info ("Public IP Loopback update needed: Current-IP: $currentIP Resolved-IP: $resolvedIP") 
/ip address{
set [find interface=$lointerface disabled=no] network=$resolvedIPwocidr address=$resolvedIP}
:log info ("Public IP Loopback updated: Current-IP: $currentIP to Resolved-IP: $resolvedIP")
} else={
:log info ("Public IP Loopback: No update needed ($currentIP=$resolvedIP)")
}

[sarada@mikrotik.sarkoziadam.hu] > ping 6f3808bfeXXX.sn.mynetname.net count=3
SEQ   HOST         SIZE   TTL   TIME   STATUS
0   176.63.137.2XX 56    64  0ms
1    176.63.137.2XX 56    64  0ms
2   176.63.137.2XX 56    64  0ms
sent=3 received=3 packet-loss=0% min-rtt=0ms avg-rtt=0ms max-rtt=0ms