IP_BIND_ADDRESS_NO_PORT(2const) IP_BIND_ADDRESS_NO_PORT(2const)

IP_BIND_ADDRESS_NO_PORT - don't reserve an ephemeral port

Standard C library (libc-lc)

#include <netinet/in.h>  /* Definition of IP* constants */
#include <sys/socket.h>
int setsockopt(int sockfd, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT,
               const int *enable, sizeof(int));

Inform the kernel to not reserve an ephemeral port when using bind(2) with a port number of 0. The port will later be automatically chosen at connect(2) time, in a way that allows sharing a source port as long as the 4-tuple is unique.

See IPPROTO_IP(2const). See setsockopt(2). See ip(7).

Linux 4.2.

IPPROTO_IP(2const), setsockopt(2), ip(7)

2025-11-25 Linux man-pages 6.17