How to set domainname permonently on RHEL?

Zhou, Jingchen jingchen at slac.stanford.edu
Fri Nov 16 19:52:50 UTC 2007


It doesn't work after I reboot the machine. 

-----Original Message-----
From: redhat-sysadmin-list-bounces at redhat.com [mailto:redhat-sysadmin-list-bounces at redhat.com] On Behalf Of Ray Van Dolson
Sent: Friday, November 16, 2007 11:37 AM
To: redhat-sysadmin-list at redhat.com
Subject: Re: How to set domainname permonently on RHEL?

On Fri, Nov 16, 2007 at 11:33:37AM -0800, Zhou, Jingchen wrote:
> 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?
> 

Typically change the entries in /etc/sysconfig/network -- and even in /etc/sysconfig/network-scripfs/ifcfg-ethXX (could be overridden there).

You've already touched /etc/hosts, so you should be able to either reboot and observe the change, or just run 'hostname myhostname.domain'
and it should take effect right away.

Ray

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