I'm running Ubuntu 14.04 on my company's cloud service (my instance has elastic IP). I want to check out the IP address of my instance I'm running by command line, but it didn't work.
root@ubuntu14-graphite:~# hostname
ubuntu14-graphite
root@ubuntu14-graphite:~# hostname -i
hostname: Name or service not known
I don't understand the reason why.
I tried to ping to ubuntu14-graphite but it said:
unknown host ubuntu14-graphite.
Does that mean my host doesn't even exist?
I have another server (not cloud instance but physical server).
In this server I installed CentOS 6.7.
I checked the hostname's IP and it worked
even though there was nothing special in /etc/hosts
.
Here's the output of cat /etc/hosts
:
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts