How to extract your outside IP address-without a chicken or a monkey

Home > Blogs > Cisco > How to extract your outside IP address-without a chicken or a monkey

How to extract your outside IP address-without a chicken or a monkey

Like This Blog 2Mark Jacob
Added by May 15, 2017

Frequently I find myself asking students in my Network+ or Cisco CCNA classes to divulge their favorite resource to use when they want to determine their external (publicly accessible) IP address.

Here are some of the more popular answers: whatismyip.com

Or ipchicken.com.

Or perhaps even better, the ipmonkey.com:

I did not include the actual IP address that I obtained when I was writing this blog, not because it is some big secret, but because I suggest to readers to run the same tests themselves and compare output.  “Compare to what?” you ask.  Well what if I want to know my external IP address, but I want the results from a command prompt?  There is a way, so let’s see it in action.

This method uses the command prompt, but there is a way to do this in PowerShell as well.  I am not the originator of these methods, but I find them useful enough that I want to throw my voice into the mix and announce them to others who may find them useful also.

You may also like:  How to modify the time display in Cisco IOS and Wireshark

The command uses nslookup in non-interactive mode and looks like this:

nslookup myip.opendns.com resolver1.opendns.com

 See figure 4 to see the results:

 

 Hey!  That is the same address I found using the aforementioned web resources, but I did not have to launch a browser to get it!  Now you  can use that information as input in other scripted activities!

I did mention that it can also be done in PowerShell, so I will include that here, although I am not a guru on that topic (always willing to learn more…).

The command and output is

(Invoke-WebRequest -URI (“ifconfig.me/ip”)).Content

and is shown in figure 5:

 

Be aware that it could take up to a minute before the above command generates output, but it does work.  Hope you find this to be a useful tidbit!

Until next time….

Mark Jacob
Cisco and CompTIA Network + Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Agile Methodology in Project Management

0 60 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

Subnetting a TCP/IP Network using the Magic Box Method

0 373 2

In this session, we are going to look at how to subnet a Class B address into multiple network segments using what's called The Magic Box. Let's run through this real quick.

Detailed Forensic Investigation of Malware Infections – April 21, 2015

2 192 1

In this IT Security training video, Security expert Mike Danseglio (CISSP / CEH) will perform several malware investigations including rootkits, botnets, viruses, and browser toolbars.

Write a Comment

See what people are saying...

  1. Jindra Ryvola

    one of my browsers is setup with a proxy, another without, and so the IP lookup results are different (the proxy IP vs mine actual IP).

    the command line (nslookup) gets the actual IP
    the powershell came back with proxy’s IP

  2. Richard Andersson

    I often use https://whatsmyip.com since I by misstake missed the i in the name and now thats where I always land since its the first choice in browser history.

    Works good though, and contains whois history also 🙂

Share your thoughts...

Please fill out the comment form below to post a reply.