I use this script, and set # on all log info’s, but this is always on log
fetch:file “dyndns.checkip.html” crated
UpdateDynDns: No dyndns pdate needed
Is no need to be on log, and i would like to remove completely log about dyndns, only successfully change may appear on log. How to change script for this ?
This is ADSL, reconnecting are possible in any time, and on this line are PPTP VPN for bussiness work and if connection are re-eastablished in working time I need smallest time to reconnect VPN again
But this is not subject of question, I can set every 5 min, again in all day I have log with many many unnecessary info about creating file
i think you didnt understand original poster correctly - he removed all “:log” commands, but command “/tool fetch” produces log entry that cant be removed. so log still gets filled with those “fetch: file temp.txt created” messages.
however, i have 2 questions:
does doing “/tool fetch” every 5 minutes and then writing file to flash drive of RouterBoard decrease drive’s lifetime, since it is not recommended to write to flash memories often?
is there any way to get your public IP (when youre behind NAT, and cant just read it from interface) without fetching it to file first, like fetching it directly into variable?
Preventing the fetch from creating a log entry would be something that needs to be changed in the source. I don’t think there’s anything you can do in the script to prevent it.
however, i have 2 questions:
does doing “/tool fetch” every 5 minutes and then writing file to flash drive of RouterBoard decrease drive’s lifetime, since it is not recommended to write to flash memories often?
In theory yes. If you choose to fetch every 5 minutes, you’re going to see ~108k writes per year. Over time, the capacity of the flash drive will be reduced. If you want your router to last more than a few decades, you might want to avoid fetching/writing every 5 minutes.
is there any way to get your public IP (when youre behind NAT, and cant just read it from interface) without fetching it to file first, like fetching it directly into variable?
thank you very much for your time
Are you talking about a double-nat situation? If that’s the case, knowing your outside address won’t get you very far unless you control that router too, in which case, you can just read the IP from the interface.
Thank you very much for answering my questions, troy.
About the last question, I have Siemens SX763 that does PPPoE and gets public IP. Siemens has NAT turned on, and is on local IP 192.168.1.1.
My Mikrotik is on 192.168.1.254 and does another NAT for my network 10.80.0.0/16.
Since there is no way Mikrotik can query Siemens for public IP, is fetch from web only way to get it?
Hi all, first of all sorry for my bad english, I’m Brazilian.
So, reading the DNS-O-Matic API - (https://dnsomatic.com/wiki/api) - Documentation says: For clients using OpenDNS, a DNS request for myip.opendns.com will always return the public IP of the client.
# DNSoMatic automatic DNS updates
#--------------- Change Values in this section to match your setup ------------------
# User account info of DNSoMatic
:local maticuser youruser
:local maticpass yourpassword
# Set the hostname or label of network to be updated. This is the part after the double colon (::) on the DNSoMatic services page.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
# To specify multiple hosts, separate them with commas.
# Use "all.dnsomatic.com" for the matichost to update all items in dnsomatic with this IP.
:local matichost all.dnsomatic.com
#------------------------------------------------------------------------------------
# No more changes need
#OLD - Removing msg at log... fetch file...
#:global previousIP;
# Get the current public IP using DNS-O-Matic service.
#/tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt
# Read the current public IP into the currentIP variable.
#:local currentIP [/file get mypublicip.txt contents]
#NEW
:global previousIP;
:global currentIP [:resolve myip.opendns.com server=208.67.222.222];
:if ($currentIP != $previousIP) do={
:log info "DNSoMatic: Update needed"
:set previousIP $currentIP
# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
:local url "http://updates.dnsomatic.com/nic/update\3Fmyip=$currentIP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
:local matichostarray;
:set matichostarray [:toarray $matichost];
:foreach host in=$matichostarray do={
:log info "DNSoMatic: Sending update for $host"
/tool fetch url=($url . "&hostname=$host") user=$maticuser password=$maticpass mode=http dst-path=("dnsomaticupdate-" . $host . ".txt")
:log info "DNSoMatic: Host $host updated on DNSoMatic with IP $currentIP"
}
} else={}
This is only to remove fetch file at log, if you would like no log at all, remove all :log comment’s at code.
This method of fetching the wan ip works great for me too, and i’m not using opendns. This is a far superior way of scripting the dyndns updates without writing to flash and parsing the output file, which was the method i originally found somewhere else. The simplicity of this is awesome!
anyone have complete script for dyndns .. working.. and that is not write to nand?
Ok
I realized the above script, but I have a question ..
How to update if you have multiple hosts on the same account, and want to update via dnsOmatic ?