Tracking an IP address

In my job I have to manage lots of machines all over the place. Many of them are on windows.

I often find tracking IP addresses to be a difficult task if they do not have a static IP address.

So what can be done to keep track of an IP address?

Generally if I have no reliable solution setup their end, I end up asking them to visit one of the many “what is my IP” websites, and get them to read “the big number”. More often than not they end up on Google some how, and give me a Google IP instead of their own.

Not very reliable.

An idea I came up with was to provide a user with a simple script that would display their IP address in a dialogue window. I made this using a script provided by Microsoft entitled “List the Contents of a Web Page“.

url=”http://whatismyip.akamai.com/”
Set objHTTP = CreateObject(“MSXML2.XMLHTTP”)
Call objHTTP.Open(“GET”, url, FALSE)
objHTTP.Send
WScript.Echo(objHTTP.ResponseText)

Simply place this code into a file named myip.vbs and hand it over to your user. When they run it, it will display their IP address on their screen in a little dialogue box.

You will notice that I have used “whatismyip.akamai.com” as it is probably a lot more reliable than these other “what is my IP address” sites. After all Akamai is a content delivery provider for Microsoft, so you know it’s not going anywhere soon.

These days many broadband ISPs offer the ability to change your IP address to a static one for free of charge, or at least the ones I recommend do.

If they don’t, or if you prefer using a dynamic IP address many routers, (especially the netgear range) are compatible with the DynDNS service.

DynDNS will give you a hostname (eg: you.dnsalias.com) which you can use to match up to your IP address, and update it accordingly each time your IP changes.

Of course DynDNS isn’t the only service of this kind, there’s plenty of other Dynamic DNS services out there. CJB.net, No-IP and ZoneEdit are all well established and reliable services.

The CJB.net dynIP page even offers a list of programs to automatically update your CJB.NET address when your IP address changes.

A similar script to the above can be used to update Dynamic DNS services…

‘ Uncomment this line to use with CJB.net
‘ url=”http://www.cjb.net/cgi-bin/dynip.cgi?username=[username]&password=[password]”
‘ Uncomment this line to use with DynDNS.org
‘ url=”http://[username]:[password]@members.dyndns.org/nic/update?hostname=[yourhostname]”
Set objHTTP = CreateObject(“MSXML2.XMLHTTP”)
Call objHTTP.Open(“GET”, url, FALSE)
objHTTP.Send
‘ Uncomment this line to display the response (debug only)
‘ WScript.Echo(objHTTP.ResponseText)

As you can see you have a choice whether you wish to use cjb.net’s URL or dyndns’s URL, or you can specify your own. You will also notice that the “echo” is commented out so that the update is silent, however you may wish to use this if you’re having problems getting it working so you can display the error response.

Now you can set this script in your scheduler to run every few hours to ensure the IP is up-to-date.

You can adopt these scripting principle to any scripting language, including mIRC.

In the past I have used software such as DynSite, however I can’t justify paying for something that is so simple to do for free.