Solved

how to set domain name in RHEL 5.3

Posted on 2011-03-23
23
1,803 Views
Last Modified: 2012-05-11
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
Comment
Question by:sudhirgoogle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 6
  • 3
  • +3
23 Comments
 
LVL 12

Expert Comment

by:upanwar
ID: 35200565
restart the xinetd service.
ex: type service xinetd restart

It will get reflect.
0
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35200588
Actually restarted the machine, but it didn't work. also restarted xinetd, no luck
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35200606
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35200648

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

Expert Comment

by:balasundaram_s
ID: 35200703
'domainname' command is used to set the NIS domain, not the DNS domain.  Do you have NIS configured under RedHat?


0
 
LVL 12

Expert Comment

by:upanwar
ID: 35200711
You want to set the DNS Domain name or NIS Domain ?
0
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35200714
No NIS. I just want to set domain name, how do i set in RHEL 5.3
0
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35200718
DNS Domain name.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35200729
0
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35200734
i already gone through that URL, but it didn't help.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35200769
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
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35200819
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
 

Expert Comment

by:pradeepgnair
ID: 35200836
Try to edit /etc/hosts & /etc/resolv.conf file and then restart the system. This may help u in solving the problem.
0
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35200878
what you want me to edit  in those files ?? be specific
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35200915
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
 
LVL 31

Expert Comment

by:farzanj
ID: 35202475
It is NISDOMAIN=name in /etc/sysconfig/network file

You would need to reboot the machine
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35203726
0
 
LVL 6

Expert Comment

by:mohansahu
ID: 35204780
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
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35204939
Hello mohansahu:

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

0
 
LVL 6

Accepted Solution

by:
mohansahu earned 500 total points
ID: 35205896
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
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 35206027
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
 
LVL 6

Expert Comment

by:mohansahu
ID: 35206041
sysctl -w kernel.domainname=example.org is to write the kernel

-w for is write ...or try to add it manually & check .
0
 
LVL 1

Author Closing Comment

by:sudhirgoogle
ID: 35206154
Thanks for your solution. you are genius.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question