LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   hostname -d returns <blank> - how to set domain name, CentOS 6.3 (http://www.linuxquestions.org/questions/linux-networking-3/hostname-d-returns-blank-how-to-set-domain-name-centos-6-3-a-4175443975/)

Nick_C 01-03-2013 09:14 AM

hostname -d returns <blank> - how to set domain name, CentOS 6.3
 
While having provblems with getting Samba server to work, different thread, I have noticed that 'hostname -d' returns blank. Is this correct or should I be setting this domain name somewhere?

Thanks,
Nick

nini09 01-03-2013 02:47 PM

The two places where you need to have your hostname present are /etc/hosts and /etc/sysconfig/network files.

In /etc/hosts you need to have a line with the following format:

1.2.3.4 shorthostname.myexampledomain.com shorthostname

In /etc/sysconfig/network you need to have a line with the following format:

HOSTNAME=shorthostname.myexampledomain.com

Nick_C 01-04-2013 05:56 AM

Quote:

Originally Posted by nini09 (Post 4862335)
1.2.3.4 shorthostname.myexampledomain.com shorthostname

Thanks nini09, the problem was that I had the hosts entries in the wrong order with the shortname first:
1.2.3.4 shorthostname shorthostname.myexampledomain.com

Now fixed that and 'hostname -d' works fine.

Cheers,
Nick


All times are GMT -5. The time now is 02:44 AM.