Linux and IP addresses

Posted on 2014-11-18
Medium Priority
Last Modified: 2014-11-20
I have a hostname I want to examine

for instance:  xxx.xxx.com

Open in new window

So if I ping xxx.xxx.com I can get its external address


Open in new window

What utility do I use to get its internal address


Open in new window

Question by:Anthony Lucia
LVL 12

Expert Comment

by:Kent W
ID: 40450550
Unless it's on your equipment, you can't.
You will need to provide a little more explanation.  Is this hostname on your network, or on some equipment you have access to, or somewhere else?
LVL 19

Accepted Solution

jools earned 2000 total points
ID: 40452004
Have you tried the other tools? there are a few;
host, nslookup, dig

Using host;
# host www.experts-exchange.com
www.experts-exchange.com is an alias for experts-exchange-437318971.us-east-1.elb.amazonaws.com.
experts-exchange-437318971.us-east-1.elb.amazonaws.com has address
experts-exchange-437318971.us-east-1.elb.amazonaws.com has address

# host domain name pointer ec2-54-209-131-74.compute-1.amazonaws.com.

Open in new window

Or Dig

# dig experts-exchange.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> experts-exchange.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35580
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;experts-exchange.com.          IN      A

experts-exchange.com.   86400   IN      A

;; Query time: 154 msec
;; WHEN: Wed Nov 19 11:01:15 2014
;; MSG SIZE  rcvd: 54

# dig -x

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -x
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2044
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;     IN      PTR

;; ANSWER SECTION: 300  IN      PTR     ec2-54-86-90-123.compute-1.amazonaws.com.

;; Query time: 22 msec
;; WHEN: Wed Nov 19 11:01:22 2014
;; MSG SIZE  rcvd: 97

Open in new window

Or nslookup;

# nslookup www.experts-exchange.com

Non-authoritative answer:
www.experts-exchange.com        canonical name = experts-exchange-437318971.us-east-1.elb.amazonaws.com.
Name:   experts-exchange-437318971.us-east-1.elb.amazonaws.com
Name:   experts-exchange-437318971.us-east-1.elb.amazonaws.com

Open in new window

It sort of depends on if you have DNS entries or if the lookup is using the local hosts file.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Welcome back to our beginners guide of the popular Unix tool, cron. If you missed part one where we introduced this tool, the link is below. We left off learning how to build a simple script to schedule automatic back ups. Now, we’ll learn how to se…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

621 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