The netconfig(4) file describes all transport protocols on a host. The entries in the netconfig(4) file are explained briefly in Table 4-1 and in more detail in the netconfig(4) man page.
Table 4-1 netconfig(4) File
Example 4-1 shows a sample netconfig(4) file. Use of the netconfig(4) file has been changed for the inet transports, as described in the commented section in the sample file. This change is also described in "Name-to-Address Mapping".
# The "Network Configuration" File. # # Each entry is of the form: # #<net <semantics> <flags> <proto <proto <device> <nametoaddr_libs> # id> family> name> # # The "-" in <nametoaddr_libs> for inet family transports indicates redirection # to the name service switch policies for "hosts" and "services. The "-" may be # replaced by nametoaddr libraries that comply with the SVR4 specs, in which # case the name service switch will be used for netdir_getbyname, netdir_ # getbyaddr, gethostbyname, gethostbyaddr, getservbyname, and getservbyport. # There are no nametoaddr_libs for the inet family in Solaris anymore. # udp tpi_clts v inet udp /dev/udp - # tcp tpi_cots_ord v inet tcp /dev/tcp - # icmp tpi_raw - inet icmp /dev/icmp - # rawip tpi_raw - inet - /dev/rawip - # ticlts tpi_clts v loopback - /dev/ticlts straddr.so # ticots tpi_cots v loopback - /dev/ticots straddr.so # ticotsord tpi_cots_ord v loopback - /dev/ticotsord straddr.so #
Network selection library routines return pointers to netconfig entries. The netconfig structure is shown in Example 4-2.
struct netconfig { char *nc_netid; /* network identifier */ unsigned int nc_semantics; /* semantics of protocol */ unsigned int nc_flag; /* flags for the protocol */ char *nc_protofmly; /* family name */ char *nc_proto; /* proto specific */ char *nc_device; /* device name for network id */ unsigned int nc_nlookups; /* # entries in nc_lookups */ char **nc_lookups; /* list of lookup libraries */ unsigned int nc_unused[8]; };
Valid network IDs are defined by the system administrator, who must ensure that network IDs are locally unique. If they are not, some network selection routines can fail. For example, it is not possible to know which network getnetconfigent("udp") will use if there are two netconfig entries with the network ID udp.
The system administrator also sets the order of the entries in the netconfig(4) database. The routines that find entries in /etc/netconfig return them in order, from the beginning of the file. The order of transports in the netconfig(4) file is the default transport search sequence of the routines. Loopback entries should be at the end of the file.
The netconfig(4) file and the netconfig structure are described in greater detail in the netconfig(4) man page.