?
Solved

hostname -i  hostname: unknown host

Posted on 2011-10-21
7
Medium Priority
?
3,537 Views
Last Modified: 2014-11-12
I have a linux server running on Amazon's EC2. It is unable to resolve it's own host IP address. It has a static IP assigned in a VPC. When I type "hostname" it resolves the name, but "hostname -i" yields unknown host. This is causing some problems for some software.

ifconfig shows the correct IP address and the server is clearly passing traffic to the outside because I can connect to it. I believe I have allowed all traffic through firewalls in an attempt to troubleshoot this.

This server was copied to a VPC from a non VPC instance (this might have something to do with the problem / maybe a config file that needs to be changed, etc).
0
Comment
Question by:aseisman
  • 4
  • 3
7 Comments
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 2000 total points
ID: 37005694
you have to setup these values in the /etc/hosts file.


Make sure the entry exists in /etc/hosts file
Suppose IP address is
192.168.0.1           name         alias
0
 

Author Comment

by:aseisman
ID: 37005743
This is what I put in my hosts file but it does not work. Previously the IP had been 127.0.0.1

10.0.4.10 localhost localhost.localdomain
0
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 37005759
NO.

Leave that entry alone
127.0.0.1 localhost localhost.localdomain

PUT
10.0.4.10 nameYouWant myHostName.domain.com
0
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.

 

Author Comment

by:aseisman
ID: 37005767
Still not working:

127.0.0.1 localhost localhost.localdomain
10.0.4.10 name name.domain.com
0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 2000 total points
ID: 37005777
What does the command do:

host name             (Where name is the name in the /etc/hosts file)
0
 

Author Comment

by:aseisman
ID: 37006409
This worked, I needed to assign the hostname to the new hosts entry. Thank you for you quick responses and helpful insight.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37006575
Glad it did.  Actually the other command is querying the DNS and you don't have the DNS set up.
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
The article lists top benefits which gaming industry bestows with the assistance of cloud computing technology.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes
Suggested Courses

850 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