1753814 Members
7747 Online
108805 Solutions
New Discussion юеВ

/etc/services question

 
Ramones
Frequent Advisor

/etc/services question

Hi everybody

I would like to know the impact of having the same port associated with 2 different services in /etc/services file.
Thanks,
R
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: /etc/services question

Shalom,

Three possible outcomes.

1) Both services will work.
2) Neither service will work.
3) One service will work and one will not.

The most likely outcome is 2.

Note that /etc/services is really a reservations file, and products like Oracle work well without entries in it.

Note that trying to run two listeners on one port in Unix will not work.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
TTr
Honored Contributor

Re: /etc/services question

The /etc/services file is a name resolution mechanism for port numbers. Its functionality is the same as /etc/hosts. There could be zero, some or a lot of impact. It depends which program might be looking up the port with two names and which port name is found first after searching the port number.

Some commands such as netstat, lsof, lookup /etc/services to convert the port numbers to port names in their output. Other commands or specific application that depend on a port, will not run if the port they use is not listed in /etc/services and named as expected.

Which port do you need to name twice and why? Which application requires it?
James R. Ferguson
Acclaimed Contributor

Re: /etc/services question

Hi Ramones:

I'm not quite sure what you are asking. You can define aliases for a named service and lookup either the real service name or the alias [ with 'getservbyname()' ]. A particular port number can offer both TCP and UDP protocols. Have a llok at the 'getservent(3N)' manpages for more information.

Regards!

...JRF...
TTr
Honored Contributor

Re: /etc/services question

> SEP: Note that /etc/services is really a reservations file...work well without entries in it.

Naming a port in /etc/services does not reserve that port. Any application can bind to a free port (a port that is not in use) regardless of whether the port is named in /etc/services or not.