xref: /freebsd/share/man/man7/hostname.7 (revision 3d45e180f437865262fc7c39fc3239641f305737)
1afe61c15SRodney W. Grimes.\" Copyright (c) 1987, 1990, 1993
2afe61c15SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3afe61c15SRodney W. Grimes.\"
4afe61c15SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5afe61c15SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6afe61c15SRodney W. Grimes.\" are met:
7afe61c15SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9afe61c15SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11afe61c15SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12afe61c15SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13afe61c15SRodney W. Grimes.\"    must display the following acknowledgement:
14afe61c15SRodney W. Grimes.\"	This product includes software developed by the University of
15afe61c15SRodney W. Grimes.\"	California, Berkeley and its contributors.
16afe61c15SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18afe61c15SRodney W. Grimes.\"    without specific prior written permission.
19afe61c15SRodney W. Grimes.\"
20afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
31afe61c15SRodney W. Grimes.\"
32afe61c15SRodney W. Grimes.\"     @(#)hostname.7	8.2 (Berkeley) 12/30/93
337f3dea24SPeter Wemm.\" $FreeBSD$
34afe61c15SRodney W. Grimes.\"
35afe61c15SRodney W. Grimes.Dd December 30, 1993
36afe61c15SRodney W. Grimes.Dt HOSTNAME 7
373d45e180SRuslan Ermilov.Os
38afe61c15SRodney W. Grimes.Sh NAME
39afe61c15SRodney W. Grimes.Nm hostname
40afe61c15SRodney W. Grimes.Nd host name resolution description
41afe61c15SRodney W. Grimes.Sh DESCRIPTION
42afe61c15SRodney W. GrimesHostnames are domains, where a domain is a hierarchical, dot-separated
43afe61c15SRodney W. Grimeslist of subdomains; for example, the machine monet, in the Berkeley
44afe61c15SRodney W. Grimessubdomain of the EDU subdomain of the Internet would be represented as
45afe61c15SRodney W. Grimes.Pp
46afe61c15SRodney W. Grimes.Dl monet.Berkeley.EDU
47afe61c15SRodney W. Grimes.Pp
48afe61c15SRodney W. Grimes(with no trailing dot).
49afe61c15SRodney W. Grimes.Pp
50afe61c15SRodney W. GrimesHostnames are often used with network client and server programs,
51afe61c15SRodney W. Grimeswhich must generally translate the name to an address for use.
52afe61c15SRodney W. Grimes(This function is generally performed by the library routine
53afe61c15SRodney W. Grimes.Xr gethostbyname  3  . )
54afe61c15SRodney W. GrimesHostnames are resolved by the Internet name resolver in the following
55afe61c15SRodney W. Grimesfashion.
56afe61c15SRodney W. Grimes.Pp
57afe61c15SRodney W. GrimesIf the name consists of a single component, i.e. contains no dot,
58afe61c15SRodney W. Grimesand if the environment variable
59afe61c15SRodney W. Grimes.Dq Ev HOSTALIASES
60afe61c15SRodney W. Grimesis set to the name of a file,
61afe61c15SRodney W. Grimesthat file is searched for any string matching the input hostname.
62afe61c15SRodney W. GrimesThe file should consist of lines made up of two white-space separated strings,
63afe61c15SRodney W. Grimesthe first of which is the hostname alias,
64afe61c15SRodney W. Grimesand the second of which is the complete hostname
65afe61c15SRodney W. Grimesto be substituted for that alias.
66afe61c15SRodney W. GrimesIf a case-insensitive match is found between the hostname to be resolved
67afe61c15SRodney W. Grimesand the first field of a line in the file, the substituted name is looked
68afe61c15SRodney W. Grimesup with no further processing.
69afe61c15SRodney W. Grimes.Pp
70afe61c15SRodney W. GrimesIf the input name ends with a trailing dot,
71afe61c15SRodney W. Grimesthe trailing dot is removed,
72afe61c15SRodney W. Grimesand the remaining name is looked up with no further processing.
73afe61c15SRodney W. Grimes.Pp
74afe61c15SRodney W. GrimesIf the input name does not end with a trailing dot, it is looked up
75afe61c15SRodney W. Grimesby searching through a list of domains until a match is found.
76afe61c15SRodney W. GrimesThe default search list includes first the local domain,
77afe61c15SRodney W. Grimesthen its parent domains with at least 2 name components (longest first).
78afe61c15SRodney W. GrimesFor example,
79afe61c15SRodney W. Grimesin the domain CS.Berkeley.EDU, the name lithium.CChem will be checked first
80afe61c15SRodney W. Grimesas lithium.CChem.CS.Berkeley.EDU and then as lithium.CChem.Berkeley.EDU.
8115623f37SMike PritchardLithium.CChem.EDU will not be tried, as there is only one component
82afe61c15SRodney W. Grimesremaining from the local domain.
83afe61c15SRodney W. GrimesThe search path can be changed from the default
84afe61c15SRodney W. Grimesby a system-wide configuration file (see
85afe61c15SRodney W. Grimes.Xr resolver  5  ) .
86afe61c15SRodney W. Grimes.Sh SEE ALSO
87afe61c15SRodney W. Grimes.Xr gethostbyname 3 ,
88afe61c15SRodney W. Grimes.Xr resolver 5 ,
89afe61c15SRodney W. Grimes.Xr mailaddr 7 ,
90afe61c15SRodney W. Grimes.Xr named 8
91afe61c15SRodney W. Grimes.Sh HISTORY
92afe61c15SRodney W. Grimes.Nm Hostname
93aab5e1b6SMike Pritchardappeared in
94aab5e1b6SMike Pritchard.Bx 4.2 .
95