/etc/services: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
|||
Line 5: | Line 5: | ||
=Overview= | =Overview= | ||
<code>/etc/services</code> is called the "services file" and it stores the mapping between a conventional name and standard port numbers allocated to services and the associated protocol (UDP or TCP). It can optionally store aliases and comments. | <code>/etc/services</code> is called the "services file" and it stores the mapping between a conventional name and standard IANA port numbers allocated to services and the associated protocol (UDP or TCP). It can optionally store aliases and comments. | ||
The idea behind storing the name - port number mapping in a file is that programs (services) can do a <code>getportbyname()</code> socket call and get the port number they should use. For example, PostgreSQL does a <code>getportbyname ("postgres")</code> and gets 5432/tcp. If the service always uses getportbyname(), then no matter what service is run, the port number can be always reconfigured by editing /etc/services. | The idea behind storing the name - port number mapping in a file is that programs (services) can do a <code>getportbyname()</code> socket call and get the port number they should use. For example, PostgreSQL does a <code>getportbyname ("postgres")</code> and gets 5432/tcp. If the service always uses getportbyname(), then no matter what service is run, the port number can be always reconfigured by editing /etc/services. | ||
=Syntax= | =Syntax= |
Latest revision as of 19:43, 18 November 2019
Internal
Overview
/etc/services
is called the "services file" and it stores the mapping between a conventional name and standard IANA port numbers allocated to services and the associated protocol (UDP or TCP). It can optionally store aliases and comments.
The idea behind storing the name - port number mapping in a file is that programs (services) can do a getportbyname()
socket call and get the port number they should use. For example, PostgreSQL does a getportbyname ("postgres")
and gets 5432/tcp. If the service always uses getportbyname(), then no matter what service is run, the port number can be always reconfigured by editing /etc/services.
Syntax
name port/protocol aliases comments
Example
# /etc/services:
# $Id: services,v 1.55 2013/04/14 ovasik Exp $
#
# Network services, Internet style
# IANA services version: last updated 2013-04-10
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports
# are included, only the more common ones.
#
# The latest IANA port assignments can be gotten from
# http://www.iana.org/assignments/port-numbers
# The Well Known Ports are those from 0 through 1023.
# The Registered Ports are those from 1024 through 49151
# The Dynamic and/or Private Ports are those from 49152 through 65535
#
# Each line describes one service, and is of the form:
#
# service-name port/protocol [aliases ...] [# comment]
tcpmux 1/tcp # TCP port service multiplexer
tcpmux 1/udp # TCP port service multiplexe
[...]
iqobject 48619/tcp # iqobject
iqobject 48619/udp # iqobject
matahari 49000/tcp # Matahari Broker