Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

contents
Next: Remote Procedure Call Up: Various Network Applications Previous: The tcpd access control

The 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:
           service port/protocol   [aliases]

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.

           # The services file:
           #
           # well-known services
           echo           7/tcp                 # Echo
           echo           7/udp                 #
           discard        9/tcp  sink null      # Discard
           discard        9/udp  sink null      #
           daytime       13/tcp                 # Daytime
           daytime       13/udp                 #
           chargen       19/tcp  ttytst source  # Character Generator
           chargen       19/udp  ttytst source  #
           ftp-data      20/tcp                 # File Transfer Protocol (Data)
           ftp           21/tcp                 # File Transfer Protocol (Contr
           telnet        23/tcp                 # Virtual Terminal Protocol
           smtp          25/tcp                 # Simple Mail Transfer Protocol
           nntp         119/tcp  readnews       # Network News Transfer Protoco
           #
            # UNIX services
           exec         512/tcp                 # BSD rexecd
           biff         512/udp  comsat         # mail notification
           login        513/tcp                 # remote login
           who          513/udp  whod           # remote who and uptime
           shell        514/tcp  cmd            # remote command, no passwd use
           syslog       514/udp                 # remote system logging
           printer      515/tcp  spooler        # remote print spooling
           route        520/udp  router routed  # routing information protocol
 
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:

           #
           # Internet (IP) protocols
           #
           ip      0       IP              # internet protocol, pseudo protocol
           icmp    1       ICMP            # internet control message protocol
           igmp    2       IGMP            # internet group multicast protocol
           tcp     6       TCP             # transmission control protocol
           udp     17      UDP             # user datagram protocol
           raw     255     RAW             # RAW IP interface

 

contents
Next: Remote Procedure Call Up: Various Network Applications Previous: The tcpd access control

Andrew Anderson
Thu Mar 7 23:22:06 EST 1996