• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3919
  • Last Modified:

hostname -i hostname: unknown host

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
aseisman
Asked:
aseisman
  • 4
  • 3
3 Solutions
 
farzanjCommented:
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
 
aseismanAuthor Commented:
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
 
farzanjCommented:
NO.

Leave that entry alone
127.0.0.1 localhost localhost.localdomain

PUT
10.0.4.10 nameYouWant myHostName.domain.com
0
The Firewall Audit Checklist

Preparing for a firewall audit today is almost impossible.
AlgoSec, together with some of the largest global organizations and auditors, has created a checklist to follow when preparing for your firewall audit. Simplify risk mitigation while staying compliant all of the time!

 
aseismanAuthor Commented:
Still not working:

127.0.0.1 localhost localhost.localdomain
10.0.4.10 name name.domain.com
0
 
farzanjCommented:
What does the command do:

host name             (Where name is the name in the /etc/hosts file)
0
 
aseismanAuthor Commented:
This worked, I needed to assign the hostname to the new hosts entry. Thank you for you quick responses and helpful insight.
0
 
farzanjCommented:
Glad it did.  Actually the other command is querying the DNS and you don't have the DNS set up.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now