Solved

how to set domain name in RHEL 5.3

Posted on 2011-03-23
23
1,786 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
open source backup solution 1 42
maybe no no httpd.conf 6 77
Migrating a Linux server to VMware 3 106
check the file dates in unix 14 22
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é.
Fine Tune your automatic Updates for Ubuntu / Debian
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.:

763 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