How to set domainname permonently on RHEL?

Daniel.Marchand at space.gc.ca Daniel.Marchand at space.gc.ca
Fri Nov 16 20:07:06 UTC 2007


 I have a workaround to make it work on RedHat 4.

I added this line to /etc/rc.local

#--------------------------------

ypdomainname mydomainname.com

#--------------------------------

This set the domainname at boot time



Daniel



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

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

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