1fc91205eSbostic.\" Copyright (c) 1987, 1990, 1993 2fc91205eSbostic.\" The Regents of the University of California. All rights reserved. 348ff1664Skarels.\" 45e36add1Scael.\" %sccs.include.redist.man% 58cc598ccSbostic.\" 6*2545a35cSmckusick.\" @(#)hostname.7 8.2 (Berkeley) 12/30/93 748ff1664Skarels.\" 85e36add1Scael.Dd 95e36add1Scael.Dt HOSTNAME 7 105e36add1Scael.Os BSD 4.2 115e36add1Scael.Sh NAME 125e36add1Scael.Nm hostname 135e36add1Scael.Nd host name resolution description 145e36add1Scael.Sh DESCRIPTION 1548ff1664SkarelsHostnames are domains, where a domain is a hierarchical, dot-separated 1648ff1664Skarelslist of subdomains; for example, the machine monet, in the Berkeley 179b10299bSkarelssubdomain of the EDU subdomain of the Internet would be represented as 185e36add1Scael.Pp 195e36add1Scael.Dl monet.Berkeley.EDU 205e36add1Scael.Pp 2148ff1664Skarels(with no trailing dot). 225e36add1Scael.Pp 2348ff1664SkarelsHostnames are often used with network client and server programs, 2448ff1664Skarelswhich must generally translate the name to an address for use. 2548ff1664Skarels(This function is generally performed by the library routine 265e36add1Scael.Xr gethostbyname 3 . ) 27cc901334SkarelsHostnames are resolved by the Internet name resolver in the following 2848ff1664Skarelsfashion. 295e36add1Scael.Pp 3048ff1664SkarelsIf the name consists of a single component, i.e. contains no dot, 315e36add1Scaeland if the environment variable 325e36add1Scael.Dq Ev HOSTALIASES 335e36add1Scaelis set to the name of a file, 34*2545a35cSmckusickthat file is searched for any string matching the input hostname. 3548ff1664SkarelsThe file should consist of lines made up of two white-space separated strings, 3648ff1664Skarelsthe first of which is the hostname alias, 3748ff1664Skarelsand the second of which is the complete hostname 3848ff1664Skarelsto be substituted for that alias. 39cc901334SkarelsIf a case-insensitive match is found between the hostname to be resolved 4048ff1664Skarelsand the first field of a line in the file, the substituted name is looked 4148ff1664Skarelsup with no further processing. 425e36add1Scael.Pp 4348ff1664SkarelsIf the input name ends with a trailing dot, 4448ff1664Skarelsthe trailing dot is removed, 4548ff1664Skarelsand the remaining name is looked up with no further processing. 465e36add1Scael.Pp 479b10299bSkarelsIf the input name does not end with a trailing dot, it is looked up 489b10299bSkarelsby searching through a list of domains until a match is found. 499b10299bSkarelsThe default search list includes first the local domain, 509b10299bSkarelsthen its parent domains with at least 2 name components (longest first). 519b10299bSkarelsFor example, 5248ff1664Skarelsin the domain CS.Berkeley.EDU, the name lithium.CChem will be checked first 5348ff1664Skarelsas lithium.CChem.CS.Berkeley.EDU and then as lithium.CChem.Berkeley.EDU. 5448ff1664SkarelsLithium.CChem.EDU will not be tried, as the there is only one component 5548ff1664Skarelsremaining from the local domain. 569b10299bSkarelsThe search path can be changed from the default 579b10299bSkarelsby a system-wide configuration file (see 585e36add1Scael.Xr resolver 5 ) . 595e36add1Scael.Sh SEE ALSO 605e36add1Scael.Xr gethostbyname 3 , 615e36add1Scael.Xr resolver 5 , 625e36add1Scael.Xr mailaddr 7 , 635e36add1Scael.Xr named 8 645e36add1Scael.Sh HISTORY 655e36add1Scael.Nm Hostname 665e36add1Scaelappeared in 4.2 BSD. 67