1833459 Members
2950 Online
110052 Solutions
New Discussion

HOSTNAME vs NODENAME

 
SOLVED
Go to solution
Kim Kendall
Regular Advisor

HOSTNAME vs NODENAME

When doing a uname -a , the second field is the nodename. Where is this variable obtained from?
22 REPLIES 22
Jeff Schussele
Honored Contributor

Re: HOSTNAME vs NODENAME

Hi Kim,

Believe it comes from the HOSTNAME= value in /etc/rc.config.d/netconf.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Kim Kendall
Regular Advisor

Re: HOSTNAME vs NODENAME

nope
Alan Riggs
Honored Contributor
Solution

Re: HOSTNAME vs NODENAME

Nodename is set with the uname -S command. Generally it is kept synchronized with the hostname. To do otherwise creates much opportunity for confusion.
Jeff Schussele
Honored Contributor

Re: HOSTNAME vs NODENAME

OK, I can understand that.
But if it is never explicitly run after base install, is the install itself running the uname -S command?

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Kim Kendall
Regular Advisor

Re: HOSTNAME vs NODENAME

YESSSSSSS !!!!! That was it! Thanks!

Man this Forum ROCKS!
Sanjay_6
Honored Contributor

Re: HOSTNAME vs NODENAME

Hi,

Think you can change the value of "HOSTNAME" in /etc/rc.config.d/netconf and then reboot the system for the change to take effect. uname -S will make the change effective immediately.

Hope this helps.

Regds
Jeff Schussele
Honored Contributor

Re: HOSTNAME vs NODENAME

Alan,

Where is it stored?

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
James R. Ferguson
Acclaimed Contributor

Re: HOSTNAME vs NODENAME

Hi Kim:

Alan is correct. In general, great confusion is avoided by keeping the hostname and the uucp nodename the same.

When you change a server's hostname, the easiest solution is to run:

# /sbin/set_parms hostname

If for some reason you have to have a hostname that differs from the nodename, you can add a line to '/etc/rc.config.d/netconf' like:

NODENAME="mynode"

Regards!

...JRF...
Jeff Schussele
Honored Contributor

Re: HOSTNAME vs NODENAME

OK Jim,
I'd still like to know where the value for nodename is stored.

Thx,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Helen French
Honored Contributor

Re: HOSTNAME vs NODENAME

May be this document will give some information (TKB #S3100000875):

http://support2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000047556885

Life is a promise, fulfill it!
Jeff Schussele
Honored Contributor

Re: HOSTNAME vs NODENAME

Shiju,

Thanks...
So it appears that unless the env parm NODENAME is explicitly set by someone or a script, then NODENAME is pulled from the HOSTNAME field in netconf - correct?

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Kim Kendall
Regular Advisor

Re: HOSTNAME vs NODENAME

ok... uname -S gets them sync'd back up, but after a reboot... it reverts back to what it was and now NODENAME != HOSTNAME.

I had already tried to run set_parms hostname but that doesn't sync them up.

Does anybody know where uname is getting it's nodename variable from?
Alan Riggs
Honored Contributor

Re: HOSTNAME vs NODENAME

The uname information is not, to teh best of my knowledge, stored in any flat file. The uname commands point to a structure in kernel memory (if my kernalized memory serves me well) defined in utsname.h. Normally, when a system boots the /sbin/init.d/hostname script will run the uname -S command to set the uname value to be equal to the root of the HOSTNAME variable (everything before the first ".", in case a domainname is specified) defined in /etc/rc.config.d netconf.

See:
man uname (2 and 1M)
James R. Ferguson
Acclaimed Contributor

Re: HOSTNAME vs NODENAME

Hi Jeff:

If NODENAME is undefined, HOSTNAME is used. Have a look at '/sbin/init.d/hostname'. You will see that 'uname -s...' is issued based on HOSTNAME if NODENAME is empty.

Regards!

...JRF...
Helen French
Honored Contributor

Re: HOSTNAME vs NODENAME

Did you check for a parameter "NODENAME=" in the /etc/rc.config.d/netconf file ?

Check the above pointed link.
Life is a promise, fulfill it!
Kim Kendall
Regular Advisor

Re: HOSTNAME vs NODENAME

yes i did... and removed it.
Jeff Schussele
Honored Contributor

Re: HOSTNAME vs NODENAME

OK great thanks guys...

Kim,
So then it appears there has to be a script or a person setting the env var NODENAME for them to get out of sync.

Think you've got some detective work to do.

Good Luck,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
James R. Ferguson
Acclaimed Contributor

Re: HOSTNAME vs NODENAME

Hi (again) Kim:

Yes, you lose the nodename manually set after a boot. As I indicated, declare it as NODENAME in '/etc/rc.config.d/netconf'.

See also my post above, regarding '/sbin/init.d/hostname'.

Regards!

...JRF...
Alan Riggs
Honored Contributor

Re: HOSTNAME vs NODENAME

If it is being set incorrectly after reboot, then you have an incorrect HOSTNAME variable being set in /etc/rc.config.d/*. It might not be in netconf, though. I suspect that someone did something like cp netconf netconf.bak, and then changed the hostname in netconf. Tis is a bad thing. The /sbin/init.d/ sequence sources ALL of /etc/rc.config.d/* when establishing environmental variables for sacripts. So if netconf.bak comes after netconf in an ls, then it has teh values which will be used.
Kim Kendall
Regular Advisor

Re: HOSTNAME vs NODENAME

yep... grepped for the string in rc.config.d and came up with the culprit.

Thanks again!
Bill Hassell
Honored Contributor

Re: HOSTNAME vs NODENAME

The details are:

/etc/rc.config.d/netconf only documents HOSTNAME. However, if you check the scripts in /sbin/init.d that refer to HOSTNAME, you'll find the script: hostname and here is how NODENAME is used:

hostname $HOSTNAME
set_return

if [ -z "$NODENAME" ] ; then
uname -S ${HOSTNAME%%.*}
else
uname -S $NODENAME
fi
set_return

In other words, if $NODENAME has not been set (it's zero-length), then uname -S will be set to the $HOSTNAME value (with possible domain info stripped). If $NODENAME does have a value, then that value is used.

netconf is missing comments about this variable.


Bill Hassell, sysadmin
Jeff Schussele
Honored Contributor

Re: HOSTNAME vs NODENAME

Thanks, Bill.

As always you are the definitive source to clear up the ambiguities.
BTW - What TZ you in as you always seem to come in w/your posts late as compared to my CST TZ?

Cheers,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!