External IP Address

netsider

Limp Gawd
Joined
Oct 12, 2004
Messages
466
Is there anyway to tell your external IP address *without* using a web browser? I know there's tons of sites to go to.. but is there anyway to tell what it is on the client/workstation? Thanks ;)
 
Unless each machine has a public IP (ipconfig /all) then I don't think there is really an easy way to do this without installing third-party applications or just visiting a "whatsmyip" website from Google search.

It would probably be easiest to visit one of those websites, if you have access to the Router than you could easily see what the public WAN IP address is.

Alternatively you could probably ping a random host and use Wireshark to monitor the traffic (if you went the application route).
 
Only way I can think of would be to look at the DHCP info on the gateway device that's doing NAT. Most if all will usually display the external interface's info such as the IP and ISP gateway.

Packet sniffing may possibly reveal some info, some protocols may actually possibly leave the external IP in there, but pretty sure at the network layer it would be the machine's local IP and the router's internal IP. Have not played with packet sniffers in a while, and just realized I don't have one installed on this machine to play with.
 
Powershell-

Code:
$a = new-object System.Net.WebClient
$a.DownloadString("http://myexternalip.com/raw")
 
Powershell-

Code:
$a = new-object System.Net.WebClient
$a.DownloadString("http://myexternalip.com/raw")
Nice and clean! and nice find for that website. Most websites I found were not shell friendly.

If you don't have powershell you can do it the dirty way with telnet and the provided website above.
goto cmd and type the following lines, make sure to hit enter after each line. The last line you will need to hit enter twice.

Code:
telnet
open myexternalip.com 80
now wait 2 seconds.
As you enter the next part your text will begin writing at the top of your cmd prompt overwriting the text there. It will look very strange but keep typing.
Code:
GET /raw HTTP/1.1
Host: myexternalip.com
at the end of the last line you must press enter TWICE.
 
ughh, finally got myip.opendns.com to work, much cleaner then telnet. Type the following into cmd
Code:
nslookup myip.opendns.com. resolver1.opendns.com

that period after the first domain is critical.
 
If scripting is an option you could also write a basic C++ app to simply connect to one of those URLs and output the IP directly. That way you're not depending as much on dependencies such as powershell or curl. If this is a corporate environment chances are powershell wont be installed and you may not be allowed to install it. Though I think in windows you need to compile against a lib for winsock, so that makes things a bit more complicated as wherever this program is, the dll has to be there too. Been a while since I coded in windows so manybe I'm thinking of something else. Idealy you want it to be a simple stand alone app.
 
Why all this going to an external site business? SSH+sh ip int br or whatever toy router equivalent.
 
Why all this going to an external site business? SSH+sh ip int br or whatever toy router equivalent.

I don't understand?

The powershell thing works nicely. How do some gadgets and programs find your external IP, though? I mean.. does the operating system "know" what it is? Or can your external address only be seen externally, period?

Thanks guys... :D
 
I don't understand?

The powershell thing works nicely. How do some gadgets and programs find your external IP, though? I mean.. does the operating system "know" what it is? Or can your external address only be seen externally, period?

Thanks guys... :D

He is talking about logging into the border router and showing the status of the interface that connects to the ISP. If you don't run the network you are asking about then you aren't going to have that access.

All of these examples use external websites, they just pull the IP from the data being streamed to the system, instead of using a browser to read the data.

I am not aware of a way to check your external IP without an external server telling you. A system within your network is not aware that its traffic is passing through a translated IP.

I just ask Google when I need to know.
 
Yeah, I guess you can't. It makes sense that the computer itself may not know it's own external IP address, but I just figured it could find that out without using an external source... but maybe that's not the case.
 
Yeah, I guess you can't. It makes sense that the computer itself may not know it's own external IP address, but I just figured it could find that out without using an external source... but maybe that's not the case.

No it would not make any sense at all if the computer did not know its' own external address. In the case of most home users the external address belongs to the router NOT the computer. Devices know their IP addresses be internal or external, public or private.
 
No it would not make any sense at all if the computer did not know its' own external address. In the case of most home users the external address belongs to the router NOT the computer. Devices know their IP addresses be internal or external, public or private.

Yeah, it makes sense for a computer to not know it's own external IP address, since the external address belongs to the router, and not the computer itself. That's what I meant, but maybe I worded my last post wrong..

I get what you're saying... technically it's not the computer's IP. I really should have asked if the external address of a LAN is known by the computers in it's network.
 
Last edited:
Back
Top