NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N) NAME nameserver - host name server daemon SYNOPSIS /etc/nameserver [ -d ] [ -llocalsocket ] [ -rmaxretries ] [ -ttimeout ] [ -pport# ] DESCRIPTION The host name server daemon nameserver is the distributed server which maintains the host name and address data base used by the gethostbyname(3n) and gethostbyaddr(3n) subroutines. The nameserver daemon operates on both a local UTek domain and a broadcast socket to the network. The nameserver broadcasts and receives on an Internet datagram socket. When initialized, it broadcasts the address and name of all interfaces on the host machine. The names are combinations of the host name (returned by gethostname(2)) and the device name. For example: Address Name Aliases 5.128.12.52 myname myname0 mynameil0 6.128.12.65 myname myname1 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. The daemon nameserver is a transaction oriented server; it handles transactions sent to a UTek domain stream socket: /tmp/name_socket. Normally, you should use the functions gethostbyname(3n) and gethostbyaddr(3n), instead of communicating with the socket directly. If a request is found in the internal data base, the answer is sent right away. If a request cannot be found in the internal data base, the request is broadcast to all networks to see if some other host knows the answer. If an answer is not received in 3 seconds (this value can be changed using the -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 Printed 4/6/89 1
NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N) /tmp/name_debug for the local socket, and port 1163 for the remote socket. -llocalfile The UTek domain socket localfile is used instead of /etc/name_socket. -tseconds Set timeout for retrying remote requests [default 3 seconds]. -rn Make the broadcast request n times after failing before before returning a ``host unknown'' error message [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. Printed 4/6/89 2
NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N) #define MAXNETS 256 struct nb_broad { 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 seconds (set by the -t option) then the request is resent. If after 3 tries (set by the -r option) then an 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 host name: letters (uppercase or lowercase), digits, underline ( _ ), or minus sign ( - ). tekname/udp not in /etc/services The Internet datagram port number used by nameserver is not in the system file /etc/services. The server daemon 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. Printed 4/6/89 3
NAMESERVER(8N) COMMAND REFERENCE NAMESERVER(8N) [NP_ERR] An error occurred that was not a system error. Execution terminated. CAVEATS Forces unique mapping from Internet address to host name; only one /etc/hosts entry can be used for a given address (second entry is ignored). 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), and namedbg(8n). Printed 4/6/89 4
%%index%% na:408,88; sy:496,434; de:930,4098; op:5028,152;5660,2506;8646,985; fi:9631,396; di:10027,1240; rv:11267,217;11964,111; ca:12075,683; se:12758,296; %%index%%000000000181