I have to setup domainname right now when i am typing below command i am getting nonne

[root@username ~]# domainname

But hostname command giving proper result

[root@username ~]# hostname

I try to add below in vim /etc/hosts

<Server IP> example.com

but even this change wont help me.

I am trying to resolve this issue



Are you sure you want the domainname and not hostname or hostname -d? The domainname is used on hosts with NIS(YP).

If you want to set just the hostname in FQDN form, use following command:

hostnamectl set-hostname hostname.example.com

And yes, don't forget to put it into /etc/hosts.

  • Thanks for your reply but hostname command already giving the result . – Subodh Joshi Nov 23 '17 at 14:25
  • And are you using NIS? – Jaroslav Kucera Nov 23 '17 at 14:25
  • Sorry but i am newbie in this what is NIS? – Subodh Joshi Nov 23 '17 at 14:26
  • That's the why I'm asking. domainname returns the NIS domain. The NIS is described here: en.wikipedia.org/wiki/Network_Information_Service – Jaroslav Kucera Nov 23 '17 at 14:28
  • FYI..this is a virual machine inside a organization but i raised this issue due to i am getting issue in the Ldap Configuration . – Subodh Joshi Nov 23 '17 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.