161609Sbostic.\" Copyright (c) 1987, 1990, 1993 261609Sbostic.\" The Regents of the University of California. All rights reserved. 332650Skarels.\" 443696Scael.\" %sccs.include.redist.man% 532650Skarels.\" 6*65229Smckusick.\" @(#)hostname.7 8.2 (Berkeley) 12/30/93 736738Sbostic.\" 843696Scael.Dd 943696Scael.Dt HOSTNAME 7 1043696Scael.Os BSD 4.2 1143696Scael.Sh NAME 1243696Scael.Nm hostname 1343696Scael.Nd host name resolution description 1443696Scael.Sh DESCRIPTION 1532650SkarelsHostnames are domains, where a domain is a hierarchical, dot-separated 1632650Skarelslist of subdomains; for example, the machine monet, in the Berkeley 1739718Skarelssubdomain of the EDU subdomain of the Internet would be represented as 1843696Scael.Pp 1943696Scael.Dl monet.Berkeley.EDU 2043696Scael.Pp 2132650Skarels(with no trailing dot). 2243696Scael.Pp 2332650SkarelsHostnames are often used with network client and server programs, 2432650Skarelswhich must generally translate the name to an address for use. 2532650Skarels(This function is generally performed by the library routine 2643696Scael.Xr gethostbyname 3 . ) 2739916SkarelsHostnames are resolved by the Internet name resolver in the following 2832650Skarelsfashion. 2943696Scael.Pp 3032650SkarelsIf the name consists of a single component, i.e. contains no dot, 3143696Scaeland if the environment variable 3243696Scael.Dq Ev HOSTALIASES 3343696Scaelis set to the name of a file, 34*65229Smckusickthat file is searched for any string matching the input hostname. 3532650SkarelsThe file should consist of lines made up of two white-space separated strings, 3632650Skarelsthe first of which is the hostname alias, 3732650Skarelsand the second of which is the complete hostname 3832650Skarelsto be substituted for that alias. 3939916SkarelsIf a case-insensitive match is found between the hostname to be resolved 4032650Skarelsand the first field of a line in the file, the substituted name is looked 4132650Skarelsup with no further processing. 4243696Scael.Pp 4332650SkarelsIf the input name ends with a trailing dot, 4432650Skarelsthe trailing dot is removed, 4532650Skarelsand the remaining name is looked up with no further processing. 4643696Scael.Pp 4739718SkarelsIf the input name does not end with a trailing dot, it is looked up 4839718Skarelsby searching through a list of domains until a match is found. 4939718SkarelsThe default search list includes first the local domain, 5039718Skarelsthen its parent domains with at least 2 name components (longest first). 5139718SkarelsFor example, 5232650Skarelsin the domain CS.Berkeley.EDU, the name lithium.CChem will be checked first 5332650Skarelsas lithium.CChem.CS.Berkeley.EDU and then as lithium.CChem.Berkeley.EDU. 5432650SkarelsLithium.CChem.EDU will not be tried, as the there is only one component 5532650Skarelsremaining from the local domain. 5639718SkarelsThe search path can be changed from the default 5739718Skarelsby a system-wide configuration file (see 5843696Scael.Xr resolver 5 ) . 5943696Scael.Sh SEE ALSO 6043696Scael.Xr gethostbyname 3 , 6143696Scael.Xr resolver 5 , 6243696Scael.Xr mailaddr 7 , 6343696Scael.Xr named 8 6443696Scael.Sh HISTORY 6543696Scael.Nm Hostname 6643696Scaelappeared in 4.2 BSD. 67