-->
Page 1 of 1

Easy way to obtain your public IP for port routing

PostPosted: Sun May 21, 2017 10:34 pm
by heckler
Hey Group,

So my ISP doesn't supply a fixed public IP address. It can change (especially if my DSL router is rebooted).

So I found that I can have an esp module obtain the current public IP addy and send it to me in an email message.
It would be easy to have an esp module check periodically if the Pub IP had changed (by doing a comparison current/last) and send a message to inform. That way you will always be able to get back in to your IOT/Smart devices.

example code...
Code: Select allmemclear
pubip = "empty"
button "Get IP", [GetIp]
wait

[GetIp]
pubip=wget(myip.dnsomatic.com)
print pubip
wait


cheers
dwight

PS
these url's all work...
http://myip.dnsomatic.com/
http://icanhazip.com/

this one works from a dos prompt...
nslookup myip.opendns.com. resolver1.opendns.com

Re: Easy way to obtain your public IP for port routing

PostPosted: Thu Jul 06, 2017 2:32 am
by Oldbod
This is a nice universal approach. Not applicable for all, but dynamic DNS can also help. Some router manufacturers provide this free. (Google dlinkddns).