Operating System - HP-UX
1834296 Members
2152 Online
110066 Solutions
New Discussion

hostname length restriction

 
SOLVED
Go to solution
David G. Douthitt
Regular Advisor

hostname length restriction

I thought I understood this (after researching here on ITRC).... but then....

On this system (an Integrity VM running 11i v3), the name of the host is 10 characters long. The command "hostname" returns the correct result, which can also be found in /etc/hosts, /etc/rc.config.d/netconf, and sendmail.cw.

However, uname -n (as well as machinfo) returns an 8-character name - which apparently is because uname was only designed to handle eight chars.

This is in spite of the fact that this system is an Integrity Virtual Machine (IVM) running 11i v3 on an rx6600 host also running 11i v3. The documentation for 11i v3 suggests that names up to 256 chars are valid, but /usr/include/sys/utsname.h suggests that the name length restriction could be *either* 256 chars *OR* 8 chars, depending on how things fly....

Using set_parms to set the hostname shows the full 10-character hostname as well.

I thought eight character name restrictions went out ten years ago!
9 REPLIES 9
Analyst
Trusted Contributor

Re: hostname length restriction

Hi David ,

You are right, the limitation is there.

If harderning has been done , The hostname display limits to 8 characters.

Correct me If Iam wrong.

Thanks,
Analyst.
Bill Hassell
Honored Contributor

Re: hostname length restriction

There are two different methods in Unix to identify a system for networking and they are covered in the man page for hostname. uname is the system standard for several decades and must remain for compatibility. However, a system may have dozens of network names for the purpose of modern networking. These names might be abc, abc123xyz, abc.mydomain.com and so on. The hostname becomes muddied when you add multiple LAN cards -- now the system can have several names.

So both names (8 and 10 chars) are correct and it is recommended that both names be added to /etc/hosts for the primary LAN address. If you use DNS, add both names to your DNS server(s). In addition, you should edit the /etc/rc.config.d/netconf file to reflect both names in the correct context:

HOSTNAME=longnetworkname
NODENAME=shortnm

The script /sbin/init.d/hostname shows how both names are set (hostname=$NODENAME, and uname=$HOSTNAME). The script sets hostname to the long name and if NODENAME is defined, then uname is set to $NODENAME.


Bill Hassell, sysadmin
Johnson Punniyalingam
Honored Contributor

Re: hostname length restriction

Hi,

please check below documentation

http://docs.hp.com/en/J6380-90010/J6380-90010.pdf
Problems are common to all, but attitude makes the difference
David G. Douthitt
Regular Advisor

Re: hostname length restriction

Johnson: Are you sure that is the right document? It is HP-UX SNAplus2 - which is not used here and has no documentation on hostnames.

Bill: That's great information! Unfortunately, the hostnames will be of the form: lhostname1, lhostname2, lhostname3 (just examples) - which leads to a "shortname" of lhostnam for all three.

It looks like the best thing to do is to shorten the hostnames to under eight chars.

But still, I thought the eight char limitation went out years and years ago - just like the 16-bit limitation on useerids and the 2Gb limit on UNIX files. Don't all of the network tools handle 256-char hostnames?

Why can't I use the 256-char limit that 11i v3 says it has instead of the 8-char limit it appears to have in practice?
Robert-Jan Goossens_1
Honored Contributor
Solution

Re: hostname length restriction

Ryan Green
Valued Contributor

Re: hostname length restriction

While HP still recommends the use of the standard length name. They have supplied patch bundles for 11i v2 to use expanded names. For 11i v3, we are running a VM with nine characters. The commands uname -n, machinfo, and hostname are correctly returning the long name.

Have you modified the kernel parameter for v3, expanded_node_host_names(5)? This should be set to one (1) to enable extended node and host names.
David G. Douthitt
Regular Advisor

Re: hostname length restriction

Robert-Jan: that is the "magic bullet". Wow! Thanks for the document.

For history's sake, here's what I found (in summary). Bill's description was fantastic, and is correct in short.

Ryan is correct; the parameter is expanded_host_names. To set it, use

# kctune expanded_host_names=1

One other thing no one has yet mentioned is what uname(2) should do if it finds the name is too long for it (such as when the expanded_host_names parameter is set to 0). This option is set by uname_eoverflow(5).

If the hostname used by (or returned by) uname(2) is too long, it can either truncate (uname_eoverflow=0) or return an error, EOVERFLOW (uname_eoverflow=1).

Thanks everybody!
David G. Douthitt
Regular Advisor

Re: hostname length restriction

Closing thread. Whitepaper link presented by Robert-Jan details everything about the hostname limitations one could ever hope to know.

The document's name is "Node and Host Name Sizes on HP-UX" with subtitle "Using the Expanded Capabilities of HP-UX". The version I retrieved is Revision 2.0 January 2007 (HP-UX 11i v3 or B.11.31.01).
Dennis Handly
Acclaimed Contributor

Re: hostname length restriction

>One other thing no one has yet mentioned is what uname(2) should do if it finds the name is too long for it

A recently found problem may cause dld to abort on 11.31.