Which field(s) can be a key in the table in /etc/services?

Clash Royale CLAN TAG#URR8PPP
In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:
The /etc/services file consists of lines containing three columns,
as shown in the following examples:# Service name port/protocol [aliases]
http 80/tcp # Hypertext Transfer Protocol
http 80/udp
ssh 22/tcp # Secure Shell
ssh 22/udp
telnet 23/tcp # Telnet
telnet 23/udp
smtp 25/tcp # Simple Mail Transfer Protocol
smtp 25/udp
Which field(s) can be a key in the table?
The example shows a service name can correspond to more than one transport protocols.
Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?
Thanks.
linux services
add a comment |
In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:
The /etc/services file consists of lines containing three columns,
as shown in the following examples:# Service name port/protocol [aliases]
http 80/tcp # Hypertext Transfer Protocol
http 80/udp
ssh 22/tcp # Secure Shell
ssh 22/udp
telnet 23/tcp # Telnet
telnet 23/udp
smtp 25/tcp # Simple Mail Transfer Protocol
smtp 25/udp
Which field(s) can be a key in the table?
The example shows a service name can correspond to more than one transport protocols.
Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?
Thanks.
linux services
add a comment |
In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:
The /etc/services file consists of lines containing three columns,
as shown in the following examples:# Service name port/protocol [aliases]
http 80/tcp # Hypertext Transfer Protocol
http 80/udp
ssh 22/tcp # Secure Shell
ssh 22/udp
telnet 23/tcp # Telnet
telnet 23/udp
smtp 25/tcp # Simple Mail Transfer Protocol
smtp 25/udp
Which field(s) can be a key in the table?
The example shows a service name can correspond to more than one transport protocols.
Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?
Thanks.
linux services
In /etc/services, a service name can have multiple (transport protocol, port number) pairs. For example, The Linux Programming Interface says:
The /etc/services file consists of lines containing three columns,
as shown in the following examples:# Service name port/protocol [aliases]
http 80/tcp # Hypertext Transfer Protocol
http 80/udp
ssh 22/tcp # Secure Shell
ssh 22/udp
telnet 23/tcp # Telnet
telnet 23/udp
smtp 25/tcp # Simple Mail Transfer Protocol
smtp 25/udp
Which field(s) can be a key in the table?
The example shows a service name can correspond to more than one transport protocols.
Given a service name and a transport protocol, can they correspond to more than one port numbers? In other words, can a service listen at two ports in the same transport protocol?
Thanks.
linux services
linux services
asked Feb 13 at 21:41
TimTim
27.5k78264476
27.5k78264476
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:
- name and protocol;
- port number and protocol.
Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:
http 80/tcp www # WorldWideWeb HTTP
Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.
Thanks. "can a service listen at two ports in the same transport protocol?"
– Tim
Feb 13 at 21:53
The key (uniqueness) requirement answers that, doesn’t it?
– Stephen Kitt
Feb 13 at 21:54
Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?
– Tim
Feb 13 at 21:56
Can a service have two ports in the same transport protocol for its listening purpose?
– Tim
Feb 13 at 22:19
1
We’ve gone a long way from “which field(s) can be a key in the table in/etc/services?” at this point...
– Stephen Kitt
Feb 14 at 17:43
|
show 13 more comments
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500497%2fwhich-fields-can-be-a-key-in-the-table-in-etc-services%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:
- name and protocol;
- port number and protocol.
Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:
http 80/tcp www # WorldWideWeb HTTP
Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.
Thanks. "can a service listen at two ports in the same transport protocol?"
– Tim
Feb 13 at 21:53
The key (uniqueness) requirement answers that, doesn’t it?
– Stephen Kitt
Feb 13 at 21:54
Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?
– Tim
Feb 13 at 21:56
Can a service have two ports in the same transport protocol for its listening purpose?
– Tim
Feb 13 at 22:19
1
We’ve gone a long way from “which field(s) can be a key in the table in/etc/services?” at this point...
– Stephen Kitt
Feb 14 at 17:43
|
show 13 more comments
The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:
- name and protocol;
- port number and protocol.
Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:
http 80/tcp www # WorldWideWeb HTTP
Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.
Thanks. "can a service listen at two ports in the same transport protocol?"
– Tim
Feb 13 at 21:53
The key (uniqueness) requirement answers that, doesn’t it?
– Stephen Kitt
Feb 13 at 21:54
Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?
– Tim
Feb 13 at 21:56
Can a service have two ports in the same transport protocol for its listening purpose?
– Tim
Feb 13 at 22:19
1
We’ve gone a long way from “which field(s) can be a key in the table in/etc/services?” at this point...
– Stephen Kitt
Feb 14 at 17:43
|
show 13 more comments
The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:
- name and protocol;
- port number and protocol.
Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:
http 80/tcp www # WorldWideWeb HTTP
Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.
The file is described in the services(5) manpage, and its usage in the related functions’ manpage. The latter shows that the following pairs are expected to be keys:
- name and protocol;
- port number and protocol.
Note that services can have aliases (which your example doesn’t illustrate). www for instance is typically an alias for http:
http 80/tcp www # WorldWideWeb HTTP
Regarding what services can do, /etc/services only provides a mapping, it doesn’t constrain anything. Thus, someone asking for http on TCP will be told that the corresponding assigned port is 80, but an HTTP dæmon can listen on any port it wants to (and is allowed to); likewise, someone asking for port 80 on TCP will be told that the corresponding name is http, but that doesn’t mean that a server listening on port 80 has to be an HTTP server. Furthermore, single processes can listen on multiple ports, and on BSDs and Linux since kernel 3.9, multiple processes can listen on the same port.
edited Feb 14 at 6:45
answered Feb 13 at 21:47
Stephen KittStephen Kitt
175k24400477
175k24400477
Thanks. "can a service listen at two ports in the same transport protocol?"
– Tim
Feb 13 at 21:53
The key (uniqueness) requirement answers that, doesn’t it?
– Stephen Kitt
Feb 13 at 21:54
Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?
– Tim
Feb 13 at 21:56
Can a service have two ports in the same transport protocol for its listening purpose?
– Tim
Feb 13 at 22:19
1
We’ve gone a long way from “which field(s) can be a key in the table in/etc/services?” at this point...
– Stephen Kitt
Feb 14 at 17:43
|
show 13 more comments
Thanks. "can a service listen at two ports in the same transport protocol?"
– Tim
Feb 13 at 21:53
The key (uniqueness) requirement answers that, doesn’t it?
– Stephen Kitt
Feb 13 at 21:54
Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?
– Tim
Feb 13 at 21:56
Can a service have two ports in the same transport protocol for its listening purpose?
– Tim
Feb 13 at 22:19
1
We’ve gone a long way from “which field(s) can be a key in the table in/etc/services?” at this point...
– Stephen Kitt
Feb 14 at 17:43
Thanks. "can a service listen at two ports in the same transport protocol?"
– Tim
Feb 13 at 21:53
Thanks. "can a service listen at two ports in the same transport protocol?"
– Tim
Feb 13 at 21:53
The key (uniqueness) requirement answers that, doesn’t it?
– Stephen Kitt
Feb 13 at 21:54
The key (uniqueness) requirement answers that, doesn’t it?
– Stephen Kitt
Feb 13 at 21:54
Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?
– Tim
Feb 13 at 21:56
Is it correct that a service can only listen at one port in a transport protocol, and a process can listen at two ports in the same transport protocol (so the process actually runs two services)?
– Tim
Feb 13 at 21:56
Can a service have two ports in the same transport protocol for its listening purpose?
– Tim
Feb 13 at 22:19
Can a service have two ports in the same transport protocol for its listening purpose?
– Tim
Feb 13 at 22:19
1
1
We’ve gone a long way from “which field(s) can be a key in the table in
/etc/services?” at this point...– Stephen Kitt
Feb 14 at 17:43
We’ve gone a long way from “which field(s) can be a key in the table in
/etc/services?” at this point...– Stephen Kitt
Feb 14 at 17:43
|
show 13 more comments
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500497%2fwhich-fields-can-be-a-key-in-the-table-in-etc-services%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown