Solved

how to set domain name in RHEL 5.3

Posted on 2011-03-23
23
1,725 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
BASH script to modify crontab? 3 50
bash script question (chmod) 10 56
i can not do linux commands in cygwin windows 10 6 62
VMware Workstation 12 Player 16 40
In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

920 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

15 Experts available now in Live!

Get 1:1 Help Now