1.\" Copyright (c) 1987, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)hostname.7 8.1 (Berkeley) 06/05/93 7.\" 8.Dd 9.Dt HOSTNAME 7 10.Os BSD 4.2 11.Sh NAME 12.Nm hostname 13.Nd host name resolution description 14.Sh DESCRIPTION 15Hostnames are domains, where a domain is a hierarchical, dot-separated 16list of subdomains; for example, the machine monet, in the Berkeley 17subdomain of the EDU subdomain of the Internet would be represented as 18.Pp 19.Dl monet.Berkeley.EDU 20.Pp 21(with no trailing dot). 22.Pp 23Hostnames are often used with network client and server programs, 24which must generally translate the name to an address for use. 25(This function is generally performed by the library routine 26.Xr gethostbyname 3 . ) 27Hostnames are resolved by the Internet name resolver in the following 28fashion. 29.Pp 30If the name consists of a single component, i.e. contains no dot, 31and if the environment variable 32.Dq Ev HOSTALIASES 33is set to the name of a file, 34that file is searched for an string matching the input hostname. 35The file should consist of lines made up of two white-space separated strings, 36the first of which is the hostname alias, 37and the second of which is the complete hostname 38to be substituted for that alias. 39If a case-insensitive match is found between the hostname to be resolved 40and the first field of a line in the file, the substituted name is looked 41up with no further processing. 42.Pp 43If the input name ends with a trailing dot, 44the trailing dot is removed, 45and the remaining name is looked up with no further processing. 46.Pp 47If the input name does not end with a trailing dot, it is looked up 48by searching through a list of domains until a match is found. 49The default search list includes first the local domain, 50then its parent domains with at least 2 name components (longest first). 51For example, 52in the domain CS.Berkeley.EDU, the name lithium.CChem will be checked first 53as lithium.CChem.CS.Berkeley.EDU and then as lithium.CChem.Berkeley.EDU. 54Lithium.CChem.EDU will not be tried, as the there is only one component 55remaining from the local domain. 56The search path can be changed from the default 57by a system-wide configuration file (see 58.Xr resolver 5 ) . 59.Sh SEE ALSO 60.Xr gethostbyname 3 , 61.Xr resolver 5 , 62.Xr mailaddr 7 , 63.Xr named 8 64.Sh HISTORY 65.Nm Hostname 66appeared in 4.2 BSD. 67