IP_FREEBIND(2const)

IP_FREEBIND2const

Bind to a nonlocal or nonexistent ip address

Usage

#include <netinet/in.h>  /* Definition of IP* constants */
#include <sys/socket.h>

int setsockopt(int sockfd, IPPROTO_IP, IP_FREEBIND, const int *enable, sizeof(int));

Library

Standard C library (libc, -lc)

Overview

If enabled, this boolean option allows binding to an IP address that is nonlocal or does not (yet) exist.

This permits listening on a socket, without requiring the underlying network interface or the specified dynamic IP address to be up at the time that the application is trying to bind to it.

This option is the per-socket equivalent of the /proc/sys/net/ipv4/ip_nonlocal_bind interface.

Errors

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

Standards

Linux.

History

Linux 2.4.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.