[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1941
  • Last Modified:

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
0
sudhirgoogle
Asked:
sudhirgoogle
  • 10
  • 6
  • 3
  • +3
1 Solution
 
upanwarCommented:
restart the xinetd service.
ex: type service xinetd restart

It will get reflect.
0
 
sudhirgoogleAuthor Commented:
Actually restarted the machine, but it didn't work. also restarted xinetd, no luck
0
 
upanwarCommented:
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.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
sudhirgoogleAuthor Commented:

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
0
 
balasundaram_sCommented:
'domainname' command is used to set the NIS domain, not the DNS domain.  Do you have NIS configured under RedHat?


0
 
upanwarCommented:
You want to set the DNS Domain name or NIS Domain ?
0
 
sudhirgoogleAuthor Commented:
No NIS. I just want to set domain name, how do i set in RHEL 5.3
0
 
sudhirgoogleAuthor Commented:
DNS Domain name.
0
 
upanwarCommented:
0
 
sudhirgoogleAuthor Commented:
i already gone through that URL, but it didn't help.
0
 
upanwarCommented:
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.
0
 
sudhirgoogleAuthor Commented:
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.
0
 
pradeepgnairCommented:
Try to edit /etc/hosts & /etc/resolv.conf file and then restart the system. This may help u in solving the problem.
0
 
sudhirgoogleAuthor Commented:
what you want me to edit  in those files ?? be specific
0
 
upanwarCommented:
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.
0
 
farzanjCommented:
It is NISDOMAIN=name in /etc/sysconfig/network file

You would need to reboot the machine
0
 
farzanjCommented:
0
 
mohansahuCommented:
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
0
 
sudhirgoogleAuthor Commented:
Hello mohansahu:

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

0
 
mohansahuCommented:
Hi Sudhir,

using /etc/sysctl.conf you can set kernel.domainname to have it permanently set on boot:
Like:-
[mohan@skftpserver ~]$ ypdomainname
(none)

[mohan@skftpserver ~]$sysctl kernel.domainname
kernel.domainname = (none)
[mohan@skftpserver ~]$sudo sysctl -w kernel.domainname=example.org
kernel.domainname = example.org
[mohan@skftpserver ~]$sysctl kernel.domainname
kernel.domainname = example.org
[mohan@skftpserver ~]$ ypdomainname
example.org

 set the DNS domain in /etc/sysconfig/network, add the line

HOSTNAME=host.my.domain

1.From /etc/rc.d/rc.sysinit this will set the FQDN via the hostname command which also sets the hosts "domainname".
2.For DNS check that domain is set in /etc/resolv.conf to ensure you can resolve hosts within your domain

Cheers,
MS
0
 
sudhirgoogleAuthor Commented:
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 ??
0
 
mohansahuCommented:
sysctl -w kernel.domainname=example.org is to write the kernel

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 6
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now