appl.servicesThe services and protocols Files appl.protocolsThe services and protocols Files
The port numbers on which certain ``standard'' services are offered are defined in the ``Assigned Numbers'' RFC. To enable server and client programs to convert service names to these numbers, at least a part of the list is kept on each host; it is stored in a file called /etc/services. An entry is made up like this:
Here, service specifies the service name, port defines the port the service is offered on, and protocol defines which transport protocol is used. Commonly, this is either udp or tcp. It is possible for a service to be offered for more than one protocol, as well as offering different services on the same port, as long as the protocols are different. The aliases field allows to specify alternative names for the same service.
Usually, you don't have to change the services file that comes along with the network software on your system. Nevertheless, we give a small excerpt from that file below.
Note that, for example, the echo service is offered on port 7 for both TCP and UDP, and that port 512 is used for two different services, namely the COMSAT daemon (which notifies users of newly arrived mail, see xbiff(1x)), over UDP, and for remote execution (rexec(1)), using TCP.
Similar to the services file, the networking library needs a way to translate protocol names -- for example, those used in the services file -- to protocol numbers understood by the IP layer on other hosts. This is done by looking up the name in the /etc/protocols file. It contains one entry per line, each containing a protocol name, and the associated number. Having to touch this file is even more unlikely than having to meddle with /etc/services. A sample file is given below: