How to set domainname permonently on RHEL?

Broekman, Maarten Maarten.Broekman at FMR.COM
Fri Nov 16 20:02:57 UTC 2007


Btw, if you really are looking for how to set the NIS/YP domain name and
not the DNS domain name, you need to set the NISDOMAIN variable in
/etc/sysconfig/network to the domain name you want.  However, that has
no bearing on the fully qualified host name.  If your hostname is
xxx.my.domain and you set NISDOMAIN to your.domain, "hostname" will show
xxx.my.domain while "domainname" will show your.domain.

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 Broekman,
Maarten
Sent: Friday, November 16, 2007 2:50 PM
To: redhat-sysadmin-list at redhat.com
Subject: RE: How to set domainname permonently on RHEL?

"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


--
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