Ephemeral ports

Ephemeral ports

Post by son.. » Wed, 31 Jan 2001 07:48:52



Hi All:
I was wondering if there is any portable way to find the
ephemeral/anonymous port range for your OS. I understand this is
different for each OS.
In particular I m trying to find the range for HP-UX.

Thanks
Sony

Sent via Deja.com
http://www.deja.com/

 
 
 

Ephemeral ports

Post by phil-news-nos.. » Wed, 31 Jan 2001 13:43:12



| I was wondering if there is any portable way to find the
| ephemeral/anonymous port range for your OS. I understand this is
| different for each OS.
| In particular I m trying to find the range for HP-UX.

First be sure you are not running as root.  Start with the range
of 0-65535.  Divide the range in half.  Try to listen on the port
in the middle.  If failure, recurse the upper half.  If success,
recurse the lower half.  It will be narrowed down in 16 tries.

If there are other processes with ports open, they may interfere
with the tests giving invalid results.

Have fun.

--
-----------------------------------------------------------------
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |

-----------------------------------------------------------------

 
 
 

Ephemeral ports

Post by son.. » Wed, 31 Jan 2001 14:42:07


is

Quote:> | different for each OS.
> | In particular I m trying to find the range for HP-UX.

> First be sure you are not running as root.  Start with the range
> of 0-65535.  Divide the range in half.  Try to listen on the port
> in the middle.  If failure, recurse the upper half.  If success,
> recurse the lower half.  It will be narrowed down in 16 tries.

what is the basis for this. Are you saying that if a listen() ed port
is not in the ephemeral range, it will fail. Or did you confuse the
ports 0-1024 that requires root privilage to listen to with ephemeral
ports.

Sony

Sent via Deja.com
http://www.deja.com/

 
 
 

Ephemeral ports

Post by phil-news-nos.. » Wed, 31 Jan 2001 18:08:27



| is
|> | different for each OS.
|> | In particular I m trying to find the range for HP-UX.
|>
|> First be sure you are not running as root.  Start with the range
|> of 0-65535.  Divide the range in half.  Try to listen on the port
|> in the middle.  If failure, recurse the upper half.  If success,
|> recurse the lower half.  It will be narrowed down in 16 tries.
|
| what is the basis for this. Are you saying that if a listen() ed port
| is not in the ephemeral range, it will fail. Or did you confuse the
| ports 0-1024 that requires root privilage to listen to with ephemeral
| ports.

As far as I understood your needs, I thought they were the same.
But I guess you have some other interest in the minor difference.
Maybe there is no means available to determine this at all.  I do
not know of any specific system call to reveal it.  Some systems,
such as OpenBSD, work hard to obscure things and I think these
are done as well.

--
-----------------------------------------------------------------
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |

-----------------------------------------------------------------

 
 
 

Ephemeral ports

Post by son.. » Tue, 06 Feb 2001 05:58:32


Quote:> | is not in the ephemeral range, it will fail. Or did you confuse the
> | ports 0-1024 that requires root privilage to listen to with
ephemeral
> | ports.

> As far as I understood your needs, I thought they were the same.

No they are entirely different.

Quote:> But I guess you have some other interest in the minor difference.
> Maybe there is no means available to determine this at all.  I do
> not know of any specific system call to reveal it.  Some systems,
> such as OpenBSD, work hard to obscure things and I think these
> are done as well.

Ephemeral/anonymous ports are ports used by an OS when you dont specify
a port explicitly. Like when a TCP client executes a connect() without
doing a bind(), OS assigns a random port in the ephemeral range to the
socket.
It is important when you write a server. You have to make sure that
your server is not written to listen to a port in the ephemeral range.
Reason is that - it is possible that the OS might have assigned the
port to some other processes if it is in the ephemeral range. So trhe
server will fail to bind() when it comes up.

Since each flavours of OS will have a seperate range ( I know for
solaris this is from 32K to 64 K ), one needs some way to determine
this which is what I was asking.

Sony

Sent via Deja.com
http://www.deja.com/