CentOS hostname -f returns hostname: Unknown host

Hello, does anybody know why hostname -f returns "hostname: Unknown host" for me?

I just set up a CentOS 6 (32-bit) 512MB linode and followed the CentOS wiki to change my hostname to somehostname. I did it by doing the following:

$hostname somehostname

Also the new hostname permanent by modifying HOSTNAME in /etc/sysconfig/network (HOMENAME=somehostname).

I rebooted the instance even. I now see my correct hostname in the PS1 prompt and if i do just "hostname". However, I couldn't get the full name somehow.

Anybody had a similar issue and know how to resolve it? Thanks!

3 Replies

Did you follow this guide? http://library.linode.com/networking/co … tos-fedora">http://library.linode.com/networking/configuring-static-ip-interfaces#sph_centos-fedora

It will do that if the hostname is not resolvable. Make sure you actually have a DNS record for the hostname.

@jbenamy:

Did you follow this guide? http://library.linode.com/networking/co … tos-fedora">http://library.linode.com/networking/configuring-static-ip-interfaces#sph_centos-fedora

Yes I did.

@Nibbler:

It will do that if the hostname is not resolvable. Make sure you actually have a DNS record for the hostname.

I think this may be my problem.

Thanks for the replies!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct