---
name: "IPV6_MULTICAST_IF"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/IPV6_MULTICAST_IF"
---

# IPV6\_MULTICAST\_IF(2const)

local device for a multicast socket

## NAME

IPV6\_MULTICAST\_IF - local device for a multicast socket

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

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

**int setsockopt(int** *sockfd***, IPPROTO\_IPV6, IPV6\_MULTICAST\_IF,**                **const int \****ifindex***, sizeof(int));** **int getsockopt(int** *sockfd***, IPPROTO\_IPV6, IPV6\_MULTICAST\_IF,**                **int \****ifindex***, sizeof(int));**

## DESCRIPTION

Set the device for outgoing multicast packets on the socket.

This is allowed only for **SOCK\_DGRAM** and **SOCK\_RAW** socket.

The argument is a pointer to an interface index (see [**netdevice**(7)](/netdevice/7.md)) in an integer.

## ERRORS

See [**IPPROTO\_IPV6**(2const)](/IPPROTO_IPV6/2const.md). See [**setsockopt**(2)](/setsockopt/2.md). See [**ipv6**(7)](/ipv6/7.md).

## HISTORY

- **IPV6\_MULTICAST\_IF**

  POSIX.1-2001.

## SEE ALSO

[**IPPROTO\_IPV6**(2const)](/IPPROTO_IPV6/2const.md), [**setsockopt**(2)](/setsockopt/2.md), [**ipv6**(7)](/ipv6/7.md)
