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 2 Mark 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.

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

A Simple Introduction to Cisco CML2

0 3902 0

Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2

Creating Dynamic DNS in Network Environments

0 646 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader teaches how to create Dynamic DNS zones in Network Environments. Video Transcription: Now that we’ve installed DNS, we’ve created our DNS zones, the next step is now, how do we produce those … Continue reading Creating Dynamic DNS in Network Environments

Cable Testers and How to Use them in Network Environments

0 735 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments

Write a Comment

See what people are saying...

    Share your thoughts...

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