1827421 Members
4337 Online
109965 Solutions
New Discussion

hostname and FQDN

 
SOLVED
Go to solution
Josef Forman
Frequent Advisor

hostname and FQDN

Hi,
i've got Linux machine - RedHat Enterprise 3 ES.
I need hostname command to return FQDN fish.sea.cz, but it returns only fish.

What's wrong?

line in my /etc/hosts...
nnn.nnn.nnn.hhh fish.sea.cz fish

PF
8 REPLIES 8
xyko_1
Esteemed Contributor

Re: hostname and FQDN

Hi Josef,

try to configure your /etc/hosts as
nnn.nnn.nnn.hhh fish.sea.cz fish localhost.localdomain

Anyway you may also try
# echo `hostname``dnsdomainname`

regards,
xyko

regards,
xyko
Josef Forman
Frequent Advisor

Re: hostname and FQDN

Hi xyko,

it doesn't help.

I need to use hostname due to oracle.

PF
xyko_1
Esteemed Contributor

Re: hostname and FQDN

Hi,

did you tried my first solution ?

configure your /etc/hosts as
nnn.nnn.nnn.hhh fish.sea.cz fish localhost.localdomain

regards,
xyko
Josef Forman
Frequent Advisor

Re: hostname and FQDN

Yes,
i did.

Chris Xu
Trusted Contributor
Solution

Re: hostname and FQDN

Put this line in /etc/sysconf/nework like below:
HOSTNAME="your-desired-hostname'

It will work after reboot.

Chris
xyko_1
Esteemed Contributor

Re: hostname and FQDN

Chris is correct but there is a small mistake in the path.
The correct is /etc/sysconfig/network.
I guess you don't need to reboot the server but only to restart the network.
#/etc/init.d/network restart

regards,
Xyko
Josef Forman
Frequent Advisor

Re: hostname and FQDN

I had to reboot, not only restart the network.

THANKS
Josef Forman
Frequent Advisor

Re: hostname and FQDN

THANKS FOR YOUR SOLUTIONS.