Solved

ipadress

Posted on 2013-05-21
19
357 Views
Last Modified: 2013-05-21
Hi
I wanted to know the external ipaddress of my linux machine, i can do a nslookup <linux_hostname>, but it gives me only the internal ipaddress, but i want the external ipaddress of machine, i know if i go to http://www.whatsmyip.org, it will show my ipaddress from a window's machine, but from a linux machine how to get it ?
0
Comment
Question by:wasman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 9
19 Comments
 
LVL 8

Expert Comment

by:Pepe2323
ID: 39184576
Hi

if you are connected to a swtich/router  your linux doesn't have the external ip , the device have it is router

if you have a pppoe you shall be able to see it with a ifconfig -a and the interface will be
ppp0

i hope it clarify your question
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39184591
Try this:

wget http://ipecho.net/plain -O - -q
0
 

Author Comment

by:wasman
ID: 39184602
can i use wget command to get my ipaddress


$ wget www.whatsmyip.org
--10:46:09--  http://www.whatsmyip.org/
           => `index.html'
Resolving www.whatsmyip.org... 204.11.33.59
Connecting to www.whatsmyip.org|204.11.33.59|:80... failed: Connection refused.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39184604
See my comment!
0
 

Author Comment

by:wasman
ID: 39184620
i tried it, but looks like ipecho.net is blocked by my proxy ,

$ wget http://ipecho.net/plain -O - -q
$

i get nothing, form the IE browser i see it's blocked
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39184681
wget findmyip.org -O - -q |grep "Your IP address is" | awk  '{sub("</span>","",$6); print $6}'
0
 

Author Comment

by:wasman
ID: 39184731
looks like findmyip.org is also blocked from my IE proxy

but this one --> http://whatismyipaddress.com/ is working, please apply your awk command this website and grep for "IP Information"
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39184749
This address is giving me "Service Temporarily Unavailable"

If you can access it please run

wget http://whatismyipaddress.com -O - -q

and post the output so I can try to write an appropriate parser.

But I fear those guys don't like being accessed by scripts ...
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39184766
I found their API:

wget bot.whatismyipaddress.com -O - -q
0
 

Author Comment

by:wasman
ID: 39184771
this command gives me nothing, it just comes back to prompt

$ wget http://whatismyipaddress.com -O - -q
$

but below are websites working from my Internet explorer and chrome gui browser
http://www.whatismyip.com/
http://whatismyipaddress.com/
http://www.whatsmyip.org/
http://www.howtofindmyipaddress.com/
0
 

Author Comment

by:wasman
ID: 39184775
nope, it's not showing any thing
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39184825
curl bot.whatismyipaddress.com

Errrors?
0
 

Author Comment

by:wasman
ID: 39184835
$ curl bot.whatismyipaddress.com
curl: (7) couldn't connect
$
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39184844
Seems you can't connect to anything.

curl http://www.howtofindmyipaddress.com

That's one of the addresses you said to be working.

Any results? If so:

wget  http://www.howtofindmyipaddress.com/ -O - -q | awk '{if($0~/Your IP Address Is/) {getline;getline;getline;FS=">|<";print $3;exit}}'
0
 

Author Comment

by:wasman
ID: 39185333
looks like my linux machines are not able to dns lookup , because i see i am able to run wget only against websites which are referred in the /etc/hosts?
 
i am right ?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39185447
What do you see with

nslookup www.howtofindmyipaddress.com   

?

If you get an error: Do you have a file named /etc/resolv.conf ?

If you don't: is there a DNS server in your internal network at all?

If anything fails you can add the address of www.howtofindmyipaddress.com to /etc/hosts:

206.71.145.70  www.howtofindmyipaddress.com
0
 

Author Comment

by:wasman
ID: 39185488
$ nslookup www.howtofindmyipaddress.com
Server:         192.34.223.11
Address:        192.34.223.11#53

Non-authoritative answer:
www.howtofindmyipaddress.com    canonical name = howtofindmyipaddress.com.
Name:   howtofindmyipaddress.com
Address: 206.71.145.70

$

the nslookup is working
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39185506
So your problems are not related to DNS.

I'd suggest contacting your firewall/proxy admin to ask them what it's all about.
0
 

Author Closing Comment

by:wasman
ID: 39185550
Thank you woolmilk, i am closing this ticket.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can't connect to FTP 18 161
Advice on ESXi 5.1 Health / Storage 1 80
simple bash script needed to unpack tar.gz 4 62
Linux Server mapping drive using SSH key 9 53
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question