Which UDP Port to Use?

Johannes Franken jfranken at jfranken.de
Sat Dec 17 20:32:27 UTC 2005


* Michael D. Berger <m.d.berger at ieee.org> [2005-12-17 19:53 +0100]:
> On RH-E-WS-4 I need to open a UDP socket for internal use.  How shall
> I select the port number?

Rules for selecting an UDP port:

- UDP port numbers can be between 1 and 65535.

- For listening on ports <1024, your daemon needs to run with UID 0
  (root user).

- As long as you're not listening on a broadcast IP, there must be no
  other program using this port (that is, neither listening or as
  source-port)

- Run "netstat -puna" to see which UDP ports are aready in use on your
  machine.

- Download http://www.iana.org/assignments/port-numbers and look for
  "Unassigned" ports, to avoid conflicts with services you might install
  later.

- Better choose a port outside the range given in
  /proc/sys/net/ipv4/ip_local_port_range, because these ports might
  already be in use as source-ports by other programs on later boots.


-- 
Johannes Franken
 
Red Hat Certfied Engineer
mailto:jfranken at jfranken.de
http://www.jfranken.de/




More information about the redhat-list mailing list