hostname --fqdn returns only hostname
hostname --fqdn returns only hostname
Whenever I issue the command "hostname --fqdn" I only get the hostname of the machine, rather than getting the hostname and domain name. Why is this? I have already edited my hosts file to have "127.0.0.1 my-pc my-pc.mydomain.com my-pc" without the "". I have also put the correct FQDN in /etc/sysconfig/network. Is there something else that I am missing?
Re: hostname --fqdn returns only hostname
Yes, your hosts file entry is wrong. It needs the fqdn as the first thing after the ip address.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: hostname --fqdn returns only hostname
(Let say my hostname is PC1 and domain name is computer.com)TrevorH wrote:Yes, your hosts file entry is wrong. It needs the fqdn as the first thing after the ip address.
The first time I tried it like this "127.0.0.1 PC1.computer.com" and when I try the command "hostname --fqdn" I get unknown host. Then I tried "127.0.0.1 PC1.computer.com PC1" and now when I do hostname --fqdn it returns the correct fqdn. Thank you for help, I hope this helps others.
Re: hostname --fqdn returns only hostname
What do you have listed for your "HOSTNAME" in /etc/sysconfig/network ?
-
- Posts: 10642
- Joined: 2005/08/05 15:19:54
- Location: Northern Illinois, USA
Re: hostname --fqdn returns only hostname
If the machine has a static IP address put this address and the FQDN in /etc/hosts, not on the localhost line.
Re: hostname --fqdn returns only hostname
is it okay if my hosts file also has this (below), or should I comment those out?gerald_clark wrote:If the machine has a static IP address put this address and the FQDN in /etc/hosts, not on the localhost line.
Code: Select all
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Re: hostname --fqdn returns only hostname
Those are correct and necessary.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke