Link to home
Start Free TrialLog in
Avatar of sudhirgoogle
sudhirgoogle

asked on

how to set domain name in RHEL 5.3

I would like to know the proper way to set the domain name  in RHEL 5.3.

I have set DOMAINNAME=example.com in /etc/sysconfig/network file, and when i use domainname command is shows none.

Please help
Avatar of upanwar
upanwar
Flag of India image

restart the xinetd service.
ex: type service xinetd restart

It will get reflect.
Avatar of sudhirgoogle
sudhirgoogle

ASKER

Actually restarted the machine, but it didn't work. also restarted xinetd, no luck
Sorry I havent looked the question properly. Write as given below in your /etc/sysconfig/network file.

HOSTNAME=example.com

Then restart the xinetd service.


It will change your system's hostname.

HOSTNAME parameter is to set the hostname not the domain name.

my hostname is station1 and i want my domain name as example.com.
 In network file i have set HOSTNAME=station1 and DOMAINNAME=example.com.

when i use domainname command it shows the output as none. when is use the domainname command it should give the output as example.com
'domainname' command is used to set the NIS domain, not the DNS domain.  Do you have NIS configured under RedHat?


You want to set the DNS Domain name or NIS Domain ?
No NIS. I just want to set domain name, how do i set in RHEL 5.3
DNS Domain name.
i already gone through that URL, but it didn't help.
In your /etc/sysconfig/network file write

HOSTNAME=station1.example.com

Then restart the xinetd service.

Here station1 is your hostname and example.com is your DNS domain name. Make the DNS entry for the same as well.
i followed your instruction except Making the DNS entry on the BIND.

when i type domainname command it returns none.

I would kindly request you to test your solution from ur end and then suggest me.
Try to edit /etc/hosts & /etc/resolv.conf file and then restart the system. This may help u in solving the problem.
what you want me to edit  in those files ?? be specific
domainname report your NIS domain name only, To check your dns domain name type:

# dnsdomainname

in /ect/hosts make entry as given below.

<Ip Address>   station1.example.com  station1

In /ect/resolv.conf

Enter your DNS server's IP Address.
Avatar of farzanj
It is NISDOMAIN=name in /etc/sysconfig/network file

You would need to reboot the machine
Hi

This is one way found,  echo the domainname on startup onto proc

echo domainname.com > /proc/sys/kernel/domainname

this should work for you???

MS
Hello mohansahu:

echo domainname.com > /proc/sys/kernel/domainname works for me. but how do i make persistent across reboot.

ASKER CERTIFIED SOLUTION
Avatar of mohansahu
mohansahu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for your response.

the command sysctl -w kernel.domainname=example.org is not updating  /etc/sysctl.conf file, in this case how will it be persistent after reboot. should i manually add entry in sysctl.conf file ??
sysctl -w kernel.domainname=example.org is to write the kernel

-w for is write ...or try to add it manually & check .
Thanks for your solution. you are genius.