NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N)
NAME
nameserver - host name server daemon
SYNOPSIS
/etc/nameserver [ -d ] [ -llocalsocket ] [ -rmaxretries ] [
-ttimeout ] [ -pport# ]
DESCRIPTION
Nameserver is the distributed server which maintains the
host name and address database used by the gethostbyname(3n)
and gethostbyaddr(3n) subroutines. Its operates on both a
local Unix domain and a broadcast socket to the network.
The Nameserver broadcasts and receives on a Internet
datagram socket. When initialized, it broadcasts the
address and name of all interfaces on the host machine. The
names are combinations of the hostname (returned by
gethostname(2)) and the device name. For example:
Address NameAliases
5.128.12.52 myname myname0 mynameil0
6.128.12.65 mynamemyname1 mynameil1
7.0.0.100 myname myname2 mynameec0
The file /etc/hosts is then read to create a list of hosts
which are not running the nameserver. Duplicates in this
file are ignored.
Nameserver is a transaction oriented server; it handles
transactions sent to a Unix domain stream socket
/tmp/name_socket. Normally, the user should use the
functions gethostbyname(3n) and gethostbyaddr(3n), instead
of communicating with the socket directly.
If a request is found in the internal database, the answer
is sent right away. If not, then the request is broadcast
to all networks to see if some other host knows the answer.
If no answer is received in 3 seconds (this value can be
changed with -t flag) then an error answer is sent.
The nameserver also answers requests from other hosts, and
forwards requests on to other networks.
TESTING
If the nameserver appears to have problems it may be tested
with the command namedbg(8n).
OPTIONS
-d Debugging, don't fork off a daemon. Use /tmp/name_debug
for the local socket, and port 1163 for the remote
socket.
Printed 10/17/86 1
NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N)
-llocalfile
The Unix domain socket localfile is used instead of
/etc/name_socket.
-tsecs
Set timeout for retrying remote requests [default 3
secs].
-rn Make the broadcast request n times after failing before
before returning ``host unknown'' [default 3 times].
-pport
Use Internet port number port instead of the entry
tekname in /etc/services.
PROTOCOL
The nameserver transmits and receives messages on the
broadcast port in the tekname service specification, see
services(5n).
The local messages sent and received, are of the form
(described in /usr/include/sys/nameserver.h):
#define MAXALIASES 7 /* max aliases for host */
#define NS_VERSION 3 /* version */
#define NSR_ERROR 0 /* type field values */
#define NSR_ANSWER 1 /* answer to a request */
#define NSR_GETNAME 2 /* Gethostbyname() */
#define NSR_GETADDR 3 /* Gethostbyaddr() */
#define NSR_STATUS 4 /* Dump hostname/addresss list */
#define NSR_DELNAME 5 /* delete all entries for name */
#define NSR_DELADDR 6 /* delete all entries for address */
struct ns_req {
u_short nr_vers;/* version of nameserver*/
u_short nr_type;/* type of request */
u_long nr_addr;/* address of host */
char nr_host[MAXHOSTNAMESIZE];
char nr_aliases[MAXALIASES][MAXHOSTNAMESIZE];
};
All fields are converted to network byte order prior to
transmission.
The broadcast request/answer formats are larger since they
include information on networks visited and a request ID.
#define MAXNETS 256
struct nb_broad {
Printed 10/17/86 2
NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N)
struct ns_req nb_req; /* request */
u_long nb_reqid; /* unique request id */
u_long nb_from; /* originally from */
u_long nb_nets[MAXNETS]; /* nets visited */
};
When forwarding a request to another network, a host extends
the nb_nets field to include all networks it is forwarding
to. This allows a host to hosts on other networks (via a
gateway). A request is never sent to a network already
listed in the nb_nets list. The datagram can be shorter
than the full structure size (answers have only request and
id).
If no answer is received in 3 secs (set by -t option) then
the request is resent. If after 3 tries (set by -r option)
then a NSR_ERROR is returned.
FILES
/tmp/name_socket local communication to nameserver
/etc/hosts hosts not running the nameserver.
DIAGNOSTICS
hostname not set!!
The hostname was not set, this is usually done by
netconfig(8n), or hostname(1n).
Invalid hostname
Only the following characters are allowed in a
hostname: letters (upper or lower), digits, underline
, or minus sign -.
tekname/udp not in /etc/services
The Internet datagram port number used by the
nameserver is not in the system file /etc/services.
Nameserver prints error messages via syslog(3c) to the
system log files, after it has disassociated at start up.
RETURN VALUE
[USAGE] Incorrect command line syntax. Execution
terminated.
[NP_ERR] An error occurred that was not a system
error. Execution terminated.
CAVEATS
Forces the mapping from Internet address to hostname to be
unique; only one /etc/hosts entry can be used for a given
address (second one is ignored).
Printed 10/17/86 3
NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N)
Currently handles only Internet address.
Should be able to talk to Internet nameserver if on Arpanet.
The nameserver may cause Host Unknown messages when in fact
the host is just down.
SEE ALSO
gethostbyaddr(3n), gethostbyname(3n), gethostent(3n),
namedbg(8n).
Printed 10/17/86 4
%%index%%
na:72,72;
sy:144,302;
de:446,2461;
op:2907,230;3281,2108;5533,873;
fi:6406,235;
di:6641,923;
rv:7564,284;
ca:7848,233;8225,230;
se:8455,272;
%%index%%000000000174