How to set domainname permonently on RHEL?

Broekman, Maarten Maarten.Broekman at FMR.COM
Fri Nov 16 19:49:44 UTC 2007


"domainname" affects the NIS/YP domain name, not the DNS domain name.
To set / show the DNS domainname, you use the "dnsdomainname" command. 

The domainname manpage illustrates the differences between hostname,
domainname, dnsdomainname, etc.

Also, if you want to get xxx back from the hostname command, you can use
"hostname -s".  This gives you the short hostname.  By default, hostname
returns the fully-qualified name (as set in the HOSTNAME field of
/etc/sysconfig/network).

Maarten Broekman
Email: maarten.broekman at fmr.com

-----Original Message-----
From: redhat-sysadmin-list-bounces at redhat.com
[mailto:redhat-sysadmin-list-bounces at redhat.com] On Behalf Of Zhou,
Jingchen
Sent: Friday, November 16, 2007 2:34 PM
To: redhat-sysadmin-list at redhat.com
Subject: How to set domainname permonently on RHEL?

I know I can set it from the command line via "domainname my.domain", my
question is how I can make it permanently (i.e., valid after reboot)?

Here is what I have:
- in /etc/hosts:
...
ip           xxx.my.domain xxx

- in /etc/resolv.conf
domain my.domain
search my.domain
....

- in /etc/sysconfig/network
HOSTNAME=xxx.my.domain

However, when I type "domainname", it returns "none", and when I type
"hostname", it returns xxx.my.domain instead of xxx.

Am I missing any?

Thanks,
JC

--
redhat-sysadmin-list mailing list
redhat-sysadmin-list at redhat.com
https://www.redhat.com/mailman/listinfo/redhat-sysadmin-list





More information about the redhat-sysadmin-list mailing list