Is there a command by which I can find my external IP of my router or my NAT\DSL Router, etc., eliminating the need to visit whatsmyip.net or similar.
|
|
There is no built-in command to do this. Part of the problem is that when you are connected to the internet through a router, your network hardware is not directly connected to the internet, so your system isn't specifically assigned an IP. It's possible you might even have multiple external IPs in some cases if you are behind a reverse proxy, as many corporate networks are set up. Your best bet might be to create a script which queries whatismyip.org, or trying to find if one already exists. (As a tip, whatismyip.org is preferable to most other solutions, since it just returns your IP as plain text - no superfluous text, links, images or other garbage. It would be much easier to use in a custom script than most of the other IP-detection sites.) |
|||
|
|
grab your own copy of
or use powershell:
(disclaimer: http://myexternalip.com was created by me) |
||||
|
|
|
Create a file named
Execute using
As nhinkle noted, it's best to choose a site that only returns the IP and not HTML + ads, etc. like:
(source: formerly http://externip.com/about) |
||||
|
|
|
I made this batch script to do that a few months ago:
It gives you the option to put the IP address in the clipboard and it sets an environmental variable - SIMPLER METHOD: Now, I just do this instead:
or...
...to get the current public IP address into the clipboard. You need cURL. |
||||
|
|
|
The script from paradroid worked fine but whatsmyip moved the web page to http://automation.whatismyip.com/n09230945.asp If you change to this, it works perfect. |
|||
|
|
|
Are you able to log into your router? Should find the info there, like on a Status page. Using a Mozilla browser & NoScript? NoScript Options | Advanced | ABE -> WAN IP. |
|||
|
|
|
You can deduce the IP on a simple network by running TRACERT. At a command prompt type tracert www.google.com or another well know web site. You will likely see the first hop is your inside interface(default Gateway) of your router. You should then see the next hop which is the external interface and the IP you are looking for. Works for most simple networks with one router and internal network. |
|||||||
|