One of the biggest peeves I have about my internet connection is they never follow up on their support tickets.
I’ve been charged for 2 static IP addresses for a year, and they never have been able to get me the proper settings so I can finish configuring a Linux router I had built awhile back (more on that in another post) My ISP uses PPPoE for configuration, and I’m convinced they just don’t know what their doing, so they can’t get me the info. I own my own domains, and they are hosted by a company where I have nearly unlimited access to a dedicated server, which is basically LAMP server. I don’t use any sort of Dynamic DNS registration because I control my own DNS servers. So Here is the solution
— getip.php This file goes onto the php web server, this is probably the simplest page I’ve ever put together.
<% $ip=$_SERVER['REMOTE_ADDR']; echo "IP Address= $ip"; %>
–isalive.vbs This file goes onto the PC running windows, You then schedule your system to run this script periodically (15 minutes?)
'<script language="vbscript"> Option Explicit on error resume next Dim oXMLHTTP SET oXMLHTTP = CreateObject("MSXML2.XMLHTTP") call oXMLHTTP.open("get", "http://www.yourdomain.goeshere/getip.php", false) oXMLHTTP.send() Dim strResponseText strResponseText = oXMLHTTP.ResponseText SET oXMLHTTP = nothing Dim strReturn strReturn = trim(strResponseText) 'wscript.echo strReturn Dim fso, outFile, logfile, oldfile Set fso = CreateObject("Scripting.FileSystemObject") Dim GetOldOutput GetOldOutput = "IP Address= 184.108.40.206" set oldfile = fso.opentextfile("C:\getip\output.txt") GetOldOutput = replace(trim(oldfile.readall()),VbCrLf,"") oldfile.close Set outFile = fso.CreateTextFile("c:\getip\output.txt", True) set logfile = fso.OpenTextFile("c:\getip\log\log.txt", 8,True) Dim Splitter if (GetOldOutput <> trim(strReturn)) then Splitter = " <> " else Splitter = " == " end if Dim OutputMessage outFile.WriteLine trim(strReturn) OutputMessage = replace("Old " & GetOldOutput & Splitter & "New " & strReturn, "IP Address= ","") logfile.writeline Date & " " & time & " - " & OutputMessage wscript.echo OutputMessage 'Update DNS?? -- I'd love to have a dynamic DNS update script if GetOldOutput <> trim(strReturn) then wscript.echo "CHANGED" Dim objMessage Set objMessage = CreateObject("CDO.Message") objMessage.From = "email@example.com" objMessage.To = "firstname.lastname@example.org" objMessage.Subject = trim(strReturn) objMessage.TextBody = OutputMessage Dim objFlds Set objFlds = objMessage.Configuration.Fields With objFlds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "yourmailserver.net" .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password" .Update End With objMessage.Send set objMessage = nothing set objFlds = nothing End IF set outfile=nothing set fso=nothing set logfile = nothing
You have to create a simple file structure, for me it was c:\isalive and a subdirectory c:\isalive\log
The end result will be a file that is added to an e-mail and sent to you when your IP changes. A side effect is if the connection times out, either the server your on, or your connection isn’t working, so you can quickly tell if you have a problem. But it only e-mails you when there is a change (if the previously stored address is different then the most recently collected)
I’ll add more detail if asked. This isn’t intended to be a tutorial, just a solution to a problem that I see many people ask about, but there are few posted solutions.