my question is regarding the IP Address assigned to a machine, whenever we go to any site which reveal our IP Address, they display a number which is assigned to the machine through which we are accessing the Internet, i want to know how is it possible to retrieve the IP Address from the local machine using which commands, if any, rather than going to the sites to know the IP Address assigned to the machine by ISP. the local machine is having an IP Address of and is having a DSL router provided by the ISP which will connect to the Internet with Win XP SP2

Looking for favorable replies.



Login to your DSL router and look at the status page. If you want to log this information build a script that simply downloads the status page.

You could also write a script with curl/wget that simply gets the page (http://checkip.dyndns.com/) on occasion.

  • This obviously depends on the DSL router being configured to allow customers to gain access to them. Many consumer grade ISPs tend to ship routers with no user-visible interface. – David Pashley Jun 3 '09 at 18:01

You're just looking for the IP assigned to your NIC? Execute:


from a command prompt.

Edit: Re-re-re-reading your question again, it looks like you're asking for the IP address assigned to the Internet-side interface of your router. That's not stored on the local machine. You're going to have to write something to get it from the router itself, or rely on a third-party site to get you that.

  • This will only work if they are directly connected to the internet, I believe he is looking to get the external IP when connected to a NAT router – Sam Cogan Jun 3 '09 at 17:44
  • Also, what if user has many NICs? What if a NIC has more than one IP? – grawity Jun 3 '09 at 17:48
  • 3
    You're downvoting me for at least trying to parse his poor English? Yeesh! I guess I should ask for clarification in a comment rather than in an answer first, eh? Yeah-- if he has multiple NICs he's going to see multiple IP addresses. Far be it from me to assume that the poster has some degree of competence and would be able to figure that out. – Evan Anderson Jun 3 '09 at 17:53
  • I agree that the question is poorly phrased, and your answer could be a valid response, I don't feel it deserves a downvote. – Sam Cogan Jun 3 '09 at 17:56

If your DSL router has SNMP, you can usually fetch via snmpget the IP address that is assigned to the external interface of your DSL router. Most, (but not all) DSL router manufacturers have SNMP, and they support MIB-II.


[root@myhost ~]# snmpwalk -v1 -c ***** ipAdEntAddr
IP-MIB::ipAdEntAddr. = IpAddress:

In this case, I am querying the "inside" IP with SNMP and I get the following IP as my external IP. where ****** is my SNMP community string or password. ipAdEntAddr is the SNMP OID string i queried to get the answer.


I like http://www.ipchicken.com/ .

It doesn't provide the additional information that Kevin's site does, but I find the name sticks in people's heads and is easy to remember.


You could download WGet then run the following command:

wget -q -O - http://automation.whatismyip.com/n09230945.asp

You will need to run this either from the WGet directory, or add it to your systems Path.

  • I think this is the best option to do it programatically. It is unclear from the question whether the information can come from an online source or must only come from information stored on the local machine. – Kevin Kuphal Jun 3 '09 at 17:53
  • The local machine has no idea, and in fact there's no guarantee that there is one and only one such IP address. – David Schwartz Aug 28 '11 at 6:41

You can download this: http://curl.haxx.se/latest.cgi?curl=win32-nossl

Extract it, then go to a command prompt and type "curl http://whatismyip.com/automation/n09230945.asp"

(same idea roughly as above by Sam)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.