IP_MULTICAST_TTL(2const) IP_MULTICAST_TTL(2const)

IP_MULTICAST_TTL - time-to-live value of outgoing multicast packets

Standard C library (libc-lc)

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

Set or read the time-to-live value of outgoing multicast packets for this socket.

The default is 1 which means that multicast packets don't leave the local network unless the user program explicitly requests it.

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

Linux 1.2.

It is very important for multicast packets to set the smallest TTL possible.

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

2025-11-25 Linux man-pages 6.17