1752822 Members
4220 Online
108789 Solutions
New Discussion юеВ

hostname and nodename

 
SOLVED
Go to solution
Shivkumar
Super Advisor

hostname and nodename

Hi,

hostname and nodename "uname -n" are stored in which files ?

Thanks,
Shiv
10 REPLIES 10
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: hostname and nodename

HOSTNAME is stored in /etc/rc.config.d/netconf. If NODENAME is not defined or is null then the NODENAME is set to HOSTNAME.

Examine /sbin/init.d/hostname and you will see how this works.
If it ain't broke, I can fix that.
Shivkumar
Super Advisor

Re: hostname and nodename

What is the purpose of having hostname and nodename defined separately ? I mean why same server is known 2 names by hostname and by nodename ?

Thanks,
Shiv
John Kittel
Trusted Contributor

Re: hostname and nodename

the man page for the hostname command explains some of the reasons, such as they are...

- John
A. Clay Stephenson
Acclaimed Contributor

Re: hostname and nodename

Essentially because there were nodenames long before there were hostnames. UNIX goes back to a time before Ethernet and TCP/IP and the main mechanism for transferring files and logging in remotely was uucp (Unix to Unix copy) using dial-up connections. There are also two distinct sets of system calls (getuname,setuname) and (gethostname,sethostname) that deal with these different identifiers. Normally, these are set to the same value. Things get a bit confusing when a machine has multiple network cards , each with a different IP address and possibly a different entry in /etc/hostnames (or DNS, NIS, NIS+, or LDAP) but these entries really only coincidentally have any connection to the names defined by the system calls.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: hostname and nodename

And to expand on Clay's explanation:

HP-UX is a standards-based system and uname must remain consistent with the standards. uname is defined as an 8-character (max) name as stated in the man page for hostname. Once a standard is changed, all sorts of problems with compatibility start showing up. Each man page documents the applicable standard(s) at the bottom.

NOTE: hostname is limited to 64 characters but nodename (the value reported by uname) is limited to 8 characters. BOTH can be set by editing the /etc/rc.conig.d/netconf file and entering separate values for HOSTNAME and NODENAME. If you must use a long hostname, then set NODENAME *and* HOSTNAME in the netconf file:

NODENAME="shorty"
HOSTNAME="shortstuffismyname"

A lot of mixed system managers will be tempted to change HOSTNAME to a long network name, not knowing that the network name (NODENAME) gets the same string and creates problems with uname.

So, if you can keep 8-character names for your servers, just set HOSTNAME and you're set. Otherwise, define NODENAME as the uname/8char-name and HOSTNAME as the network name.


Bill Hassell, sysadmin
James R. Ferguson
Acclaimed Contributor

Re: hostname and nodename

Hi Shiv:

To add to both Clay and Bill's information, on 11iv2 (11.23) there is an *optional* bundle that will allow you to use up to 255 characters for both the nodename and the hostname.

This package is available for download but should be entertained only after very *careful* analysis of your needs. The documentation surrounding this can be seen, along with the download depot, here:

http://docs.hp.com/en/5991-1101/ch05s16.html

http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=NodeHostNameXpnd

Regards!

...JRF...

Arunvijai_4
Honored Contributor

Re: hostname and nodename

Hi Shiv,

Some more information on Wikipedia.,

http://en.wikipedia.org/wiki/Hostname

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Shivkumar
Super Advisor

Re: hostname and nodename

If a machine has (1) multiple LAN cards and or (2) multiple virtual network interface on a single lan card then how to decide which is the real nodename and hostname ?

Regards,
Shiv
Bill Hassell
Honored Contributor

Re: hostname and nodename

The 'real' names are associated with a specific LAN card via the IP address. You assign the HOSTNAME/NODENAME variables and in /etc/hosts, the IP address which has $NODENAME is associated with a specific LAN instance in /etc/rc.config.d/netconf.


Bill Hassell, sysadmin