Solved

how to set domain name in RHEL 5.3

Posted on 2011-03-23
23
1,707 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
  • 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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 Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

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.…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now