Operating System - Linux
1822351 Members
4872 Online
109642 Solutions
New Discussion юеВ

Re: uname -a reports IP address of the machine and not the hostname

 
SOLVED
Go to solution
hp_user_1
Regular Advisor

uname -a reports IP address of the machine and not the hostname

Hi,

When I do a 'uname -a' on my redhat linux, it gives me the IP machine of the box instead of the hostname.

What could be the problem. Where does the uname command gets its input from.

hp_user
6 REPLIES 6
Steven E. Protter
Exalted Contributor
Solution

Re: uname -a reports IP address of the machine and not the hostname

/etc/sysconfig/network

Make sure the hostname is set in there.

service network restart

May be needed to make everything work right after you make a change.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
hp_user_1
Regular Advisor

Re: uname -a reports IP address of the machine and not the hostname

I checked the file and it contains the hostname of the machine and not the IP address of it in there.

Is there any other place where it gets the info from ??
Alex Lavrov.
Honored Contributor

Re: uname -a reports IP address of the machine and not the hostname

Check if you have /etc/hostname file.

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Steven E. Protter
Exalted Contributor

Re: uname -a reports IP address of the machine and not the hostname

Here is a valid /etc/sysconfig/network file

--
NETWORKING=yes
HOSTNAME=xos1.investmenttool.com
GATEWAY=192.168.0.1
--

Notice there is nothing about the IP address of the system in there.

See /etc/sysconfig/network-scripts/ifcfg-eth0

That is the primary network/ip configuration. It can contain hostname directives but generally does not.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Muthukumar_5
Honored Contributor

Re: uname -a reports IP address of the machine and not the hostname

Is hostname command execution returning hostname. Else set as hostname "hostname"

Check /etc/sysconfig/network file and interface files. Restart network script in /etc/init.d/net file.

hth.

Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: uname -a reports IP address of the machine and not the hostname

It is /etc/init.d/network not /etc/init.d/net. Sorry i confused with HPUX :(.

thx.
Easy to suggest when don't know about the problem!