[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to set domain name in RHEL 5.3

Posted on 2011-03-23
23
Medium Priority
?
1,921 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.
Suggested Courses
Course of the Month19 days, 3 hours left to enroll

834 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