[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 952
  • Last Modified:

I need to know my Dynamic IP sent to my email address every 3 hours or so

I have a FTP server setup on my pc and I have a dynamic IP address- I need my changing ip address sent to my email box every 3 hours or so. and not my lan , but my wan. any batch file, php, or anything.
0
Caiapfas
Asked:
Caiapfas
  • 10
  • 9
  • 3
  • +3
1 Solution
 
Gianluigi_Zanettini-MegaLab_itCommented:
Have a lok at www.dyndns.org they provide you a "static" url, even with dynamic ip.
0
 
synqueCommented:
Not directly what you requested but: you could sign up for the dynamic dns service at dyndns.org. They will redirect a static hostname on their domains (you can chose from a couple) to your dynamically changing IP adress. So your server could be always accessible under caiapfas.homeip.net, for example - they will do the redirection.

http://www.dyndns.org/services/dns/dyndns/

You just need to install one of the available dns update clients on your server and you can always access your server.
http://www.dyndns.org/support/clients/dyndns.html
0
 
synqueCommented:
I should type quicker. haha
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
colonytireDirector of TechnologyCommented:
Probably your easiest and cheapest way.....http://www.softpedia.com/get/Internet/Other-Internet-Related/IP-Monitor.shtml

Hope this helps.

0
 
synqueCommented:
I forgot to mention: dyndns.org offers the dynamic dns service for free.
0
 
DoTheDEW335Commented:
I've used Dyndns.org for years. (As they say above) it's great and a free tool you can have it detect your ip changes, update your free domain name (use one of their domain services youpickaname.gotdns.com eg..) and on top of that the software can be setup to email you the new ip address also. But you shouldn't have to do that once it's setup because you can simply type in the domain name you created. Like I created one for a few businesses. businessname.gotdns.com. anytime they need to connect to it they just use that name instead of the ip address. and the program dyndns (free) keeps that domain's ip address updated by checking it every 5 minutes.

http://kanasolution.com/files/DynDNS-3.0.0.5s.zip
0
 
CaiapfasAuthor Commented:
i'd perfer it to be some type of script
theres got to be away right?
0
 
colonytireDirector of TechnologyCommented:
Are you behind a firewall?  Does the DHCP address come from your ISP or a router?.  I think I may have something for you but I need to know what IP address you need.

0
 
oBdACommented:
Here's a batch script that will determine your external IP and send it to the email address specified. You need two external tools: wget (http://www.gnu.org/software/wget/wget.html) to download an html page with your external IP, and blat (http://sourceforge.net/projects/blat) to send the email with the information.
Just schedule the script to run every three hours or whenever.
The script will try to retrieve the IP address from the html site and put it into the email's subject, and (just in case) will use the downloaded ip site as mail body.
Just adjust the settings at the beginning.

====8<----[MyIP.cmd]----
@echo off
setlocal
set URL=http://checkip.dyndns.org/index.html
set TempFile=%~dpn0-DynDNS.html
set wgetPath=C:\Program files\wget
set blatPath=C:\Tools
set MailTo=caiapfas@domain.com
set MailFrom=wanip@domain.com
set MailSender=smtp.domain.com

if exist "%TempFile%" del "%TempFile%"
:: *** Retrieve the html document with the current IP address:
"%wgetPath%\wget.exe" %URL% -O "%TempFile%"
:: *** Extract the current IP; this relies strongly on the current format of the source:
for /f "tokens=13 delims=<>: " %%a in ('type "%TempFile%"') do set WanIP=%%a
echo Current WanIP: [%WanIP%]

:: *** Send the email:
"%blatPath%\blat.exe" "%TempFile%" -t %MailTo% -s "Current WAN IP: %WanIP%" -f %MailFrom% -server %MailServer%
====8<----[MyIP.cmd]----
0
 
CaiapfasAuthor Commented:
explain ge the external ip from a html page? please expalin more?
0
 
oBdACommented:
Whenever you download something (including a web page), the server knows your IP address.
The URL mentioned above will just display the IP address you're downloading the page with. You can just enter it into your preferred browser; just don't refresh/try too often, or you'll get blocked.
wget is a command line tool to download files over http; it will download the index.html page, extract the IP from the document, and use a command line emial program to send the email.
0
 
CaiapfasAuthor Commented:
ok so how do i set it up to run, with task manager? then what type of file do i make this? .bat?
0
 
oBdACommented:
Save it as MyIP.cmd (or whatever.cmd); .bat would work as well, but strictly speaking, this is not a (DOS) batch file, but an NT batch file using commands that aren't available in DOS.
Download wget and blat, adjust the paths and and the mail addresses at the beginning of the script. Then use the task scheduler (in Control Panel) to run the script.
Just noticed that there's a typo at the beginnin: the "MailSender" variable,
set MailSender=smtp.domain.com
should of course be named "MailServer":
set MailServer=smtp.domain.com
0
 
CaiapfasAuthor Commented:
ok iu understand all that but wget I DONT understand you have to complie it, WTF? i got lost tyring to use wget.
please advise. i hope blat is a simple exe =}
0
 
colonytireDirector of TechnologyCommented:
LOL, OK this mole hill has turned into a mountain.

OK, have your web server running, and you will also need Perl installed on your system.  This web site offers a script that will run on your web server, takes advantage of Dyndns servers....  the details and file needed are at: http://www.timestocome.com/webtools/ipfinder.html

Hope this helps.
0
 
oBdACommented:
Don't worry, you don't have to compile wget; a Windows exe is here: ftp://ftp.sunsite.dk/projects/wget/windows/wget-1.9.1b.zip
0
 
CaiapfasAuthor Commented:
ok i got all that setup and rdy, got the script rdy. when i run it . a blank black screen pops up . no email? please advise and thank you for all the help so far/!!!
0
 
oBdACommented:
Don't run it by double-clicking it. Open a command prompt and run it from there, so that you can see error messages.
0
 
CaiapfasAuthor Commented:
ok i goto the dos prompt and type "filename.cmd" is that right?
then it gives the error "The syntax of the command is not correct"
0
 
oBdACommented:
You need to change into the directory where you saved the script. Then simply start it by typing the name that you saved it under (and make sure that the path variables for blat and wget at the beginning are pointing to the correct folder(s) where you saved the tools).
0
 
CaiapfasAuthor Commented:
thats what i did the error mgs. i have the file in my root
then it gives the error "The syntax of the command is not correct"
0
 
CaiapfasAuthor Commented:
ok got it to run
but
i get this error now

wget.exe
The ordinal 3212 could not be located in the dynamic link library LIBEAY32.dll
0
 
oBdACommented:
Sorry, try it with this archive; it contains the necessary dll: ftp://ftp.sunsite.dk/projects/wget/windows/wget-1.9.1b-complete.zip
0
 
CaiapfasAuthor Commented:
ok its running perfectr now, execpt new error.
error: connection to server was dropped
smtp server error
connection::put_data() unexpected error from send(): 10053


how can i fix?
0
 
oBdACommented:
If you're sending that out directly to your ISP, you'll probably have to authenticate before you're allowed to send your mail.
Since you shouldn't download the checkip page too often (AFAIK once per ten minutes is the limit, otherwise you'll get blocked), the wget part is currently REMed out. The local copy of the index page should still be around, so you can send that.

====8<----[MyIP.cmd]----
@echo off
setlocal
set URL=http://checkip.dyndns.org/index.html
set TempFile=%~dpn0-DynDNS.html
set wgetPath=C:\Program files\wget
set blatPath=C:\Tools
set MailTo=caiapfas@domain.com
set MailFrom=wanip@domain.com
set MailServer=smtp.domain.com
set SMTPUser=SomeAccount
set SMTPPwd=SomePassword

:: *** for blat test, REM out the following two lines:
REM if exist "%TempFile%" del "%TempFile%"
:: *** Retrieve the html document with the current IP address:
REM "%wgetPath%\wget.exe" %URL% -O "%TempFile%"
:: *** Extract the current IP; this relies strongly on the current format of the source:
for /f "tokens=13 delims=<>: " %%a in ('type "%TempFile%"') do set WanIP=%%a
echo Current WanIP: [%WanIP%]

:: *** Send the email:
"%blatPath%\blat.exe" "%TempFile%" -t %MailTo% -s "Current WAN IP: %WanIP%" -f %MailFrom% -server %MailServer% -u "%SMTPUser%" -pw "%SMTPPwd%"
====8<----[MyIP.cmd]----
0
 
CaiapfasAuthor Commented:
i really dont want wget marked out b/c im going to set uit up to run every 3 hours and i really need it to be able to get the webpage. so which paret to i unremark?
0
 
oBdACommented:
That's just for testing until you get the blat thing working. If you're trying to run the script several in quick sequence, you'll be blocked from the dyndns site.
So for testing, you can do without wget. Once you receive the email, you can delete the (only two) REM in front of the command lines.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 10
  • 9
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now