Showing posts with label public ip. Show all posts
Showing posts with label public ip. Show all posts

Monday, 10 July 2017

get public ip from cmd on windows

nslookup myip.opendns.com resolver1.opendns.com

You can also use this script to write it to a file. Then you can use bginfo to display it on the desktop.

'<script language="vbscript">

' Set the URL where we can get the public IP
const URL = "http://ifconfig.me/all.xml"
set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async=false
xmldoc.load(URL)

' Loop to get the public IP from the XML
for each x in xmldoc.documentElement.childNodes
 if x.NodeName = "ip_addr" then
  myip = x.text
 end if
next

' echo for testing
'wscript.echo myip

'Output IP to file so bginfo can read it
Set objFSO=CreateObject("Scripting.FileSystemObject")
outFile="P:\Users\jack\Documents\scripts\ext-ip.txt"
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Write myip
objFile.Close

Thursday, 27 December 2012

How to get your public external IP from the CLI in Linux

Linux Public IP

If you are trying to find out what your public IP address is, you typically go to a web site specifically for this purpose, such as whatsmyip.org. Sometimes you don't have a GUI web browser installed and have to use the text based web browser lynx.

Thanks to cURL, you can easily do this from the command line too. To install cURL, run the following command:

Ubuntu: sudo apt-get install curl
openSUSE: sudo zypper install curl

To find out what public IP you are using, run this command:
curl ifconfig.me
A single line will be returned containing your public external IP address.

You can get the same results
You can get the same results using wget:
wget -qO- ifconfig.me/ip
wget -qO- ipecho.net/plain

Another method
dig +short myip.opendns.com @resolver1.opendns.com