How to set domainname permonently on RHEL?

Ray Van Dolson rvandolson at esri.com
Fri Nov 16 19:37:20 UTC 2007


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




More information about the redhat-sysadmin-list mailing list