Jump to content











Photo
- - - - -

Tool to retrieve your WAN IP address


  • Please log in to reply
6 replies to this topic

#1 Vortex

Vortex

    Frequent Member

  • Advanced user
  • 299 posts

Posted 17 March 2022 - 05:27 PM

Hello,

 

Here is a small command line tool to get your WAN IP adress. The application expects one parameter, the external source providing the WAN IP :

 

GetWanIP.exe http://whatismyip.akamai.com
GetWanIP.exe https://ipecho.net/plain
If no command line option is specified then the application defaults to the address http://icanhazip.com

Attached Files



#2 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 18 March 2022 - 10:04 AM

Easier may be is just click Whatismyip.org Or watismijnip.nl Or whatismyip.com



#3 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 18 March 2022 - 01:45 PM

@wimb

But  clicking on  a hyperlink is not command line, being able to gather the IP address from command line (or batch/script) may have its uses.

 

@Vortex

But curl can do the same, right? :unsure:

 

So it is just for the tiny size of the .exe?

 

On Windows versions with Powershell, it can be used as well:

(Invoke-WebRequest ifconfig.me/ip).Content.Trim()

 

And there is still the good/ol:

nslookup myip.opendns.com resolver1.opendns.com

 

 

:duff:

Wonko



#4 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 18 March 2022 - 05:32 PM

And there is still the good/ol:

nslookup myip.opendns.com resolver1.opendns.com

 

duff.gif

Wonko

 

i love this nslookup idea : good one !

Been using nslookup for years as well as well as https://myip.dnsomatic.com/(opendns) in a browser but never thought and combining both.



#5 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 18 March 2022 - 07:07 PM

i love this nslookup idea : good one !

 

Yep, though unlike curl (or the new little thingy by Vortex) that can use one of the many sites/services, it is "limited" (AFAIK) to the opendns.com and a couple other ones:

 

nslookup whoami.akamai.net. ns1-1.akamaitech.net

 

nslookup -q=TXT o-o.myaddr.l.google.com. ns1.google.com

 

See:

https://www.howtodoj...m-command-line/

 

There is also telnet, but with it you have one choice only:

telnet telnetmyip.com

and if I recall correctly it is not very reliable.

 

:duff:

Wonko



#6 Vortex

Vortex

    Frequent Member

  • Advanced user
  • 299 posts

Posted 18 March 2022 - 07:35 PM

Hi Wonko,

 

It's only a small command line tool to get the WAN IP address. It might be useful for batch scripting.



#7 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 19 March 2022 - 09:41 AM

 

On Windows versions with Powershell, it can be used as well:

(Invoke-WebRequest ifconfig.me/ip).Content.Trim()

 

And there is still the good/ol:

nslookup myip.opendns.com resolver1.opendns.com

 

 

Thanks for the alternative ways to get IP-adress in PowerShell or Command line scripts  :)

 

Indeed that can be quite useful.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users