LinuxCommandLibrary

ip-maddress

Display or modify multicast addresses

TLDR

List multicast addresses and how many programs are subscribed to them

$ ip [[m|maddress]]
copy

List device specific addresses
$ ip [[m|maddress]] [[s|show]] dev [ethX]
copy

Join a multicast group statically
$ sudo ip [[m|maddress]] [[a|add]] [33:33:00:00:00:02] dev [ethX]
copy

Leave a static multicast group
$ sudo ip [[m|maddress]] [[d|delete]] [33:33:00:00:00:02] dev [ethX]
copy

Display help
$ ip [[m|maddress]] [[h|help]]
copy

SYNOPSIS

ip maddress { add | del } IFADDR dev DEVICE
ip maddress { show | ls } [ dev DEVICE ] [ to PREFIX ] [ scope SCOPE ]
ip maddress flush [ dev DEVICE ] [ to PREFIX ]

PARAMETERS

add
    Adds a multicast address to the specified network device.

del
    Deletes a multicast address from the specified network device.

show | ls
    Displays the multicast addresses currently configured on network devices. 'ls' is an alias for 'show'.

flush
    Removes all multicast addresses from a specified device, or from all devices if none is specified.

dev DEVICE
    Specifies the network interface (e.g., 'eth0', 'enp0s3') to which the command applies. This option is mandatory for 'add' and 'del' and optional for 'show' and 'flush'.

IFADDR
    The multicast IP address (IPv4 or IPv6, e.g., '224.0.0.1', 'ff02::1') to be added or deleted. Required for 'add' and 'del' commands.

to PREFIX
    Filters the displayed or flushed addresses to only those matching the given IP prefix. Used with 'show' and 'flush'.

scope SCOPE
    Limits the 'show' command output to addresses belonging to a specific scope (e.g., 'link', 'site', 'global', 'host').

DESCRIPTION

The ip maddress command is a subcommand of the ip utility, part of the iproute2 suite. It provides a powerful interface for manipulating multicast addresses associated with network devices. Multicast communication is essential for efficiently sending data to a group of recipients simultaneously, commonly used in applications like streaming media, network discovery protocols (e.g., Bonjour, mDNS), and routing protocols (e.g., OSPF, PIM).

This command allows administrators to add, delete, display, and flush multicast group memberships for specific network interfaces. By managing these memberships, an interface can be configured to listen for and receive traffic destined for particular multicast groups. This is crucial for systems that need to statically join or leave multicast groups, independent of dynamic protocols like IGMP (for IPv4) or MLD (for IPv6). The command operates at both Layer 2 (MAC multicast addresses) and Layer 3 (IP multicast addresses), enabling fine-grained control over how a system participates in multicast communication within its network.

CAVEATS

Using ip maddress requires root privileges or appropriate sudo permissions. Incorrect manipulation of multicast addresses can disrupt network services that rely on multicast communication, such as service discovery or routing protocols. This command primarily manages static multicast group memberships; dynamic memberships are typically handled by IGMP (IPv4) or MLD (IPv6) protocols.

USAGE EXAMPLES

Here are some common usage examples of the ip maddress command:

Display all multicast addresses on 'eth0':
ip maddress show dev eth0

Add an IPv4 multicast address to 'eth0':
ip maddress add 239.1.1.1 dev eth0

Add an IPv6 link-local multicast address to 'eth0':
ip maddress add ff02::1:2:3 dev eth0

Delete a multicast address from 'eth0':
ip maddress del 239.1.1.1 dev eth0

Flush all multicast addresses from 'eth0':
ip maddress flush dev eth0

MULTICAST COMMUNICATION OVERVIEW

Multicast is a network addressing method where data is delivered to a group of destination computers simultaneously using a single transmission from the source. Instead of sending separate copies to each recipient (unicast) or sending to all devices on the network (broadcast), multicast allows efficient one-to-many communication. Network interfaces join specific multicast groups, signaling their interest in receiving traffic destined for those groups. The ip maddress command facilitates this joining and leaving of groups at a static level, which is fundamental for many network services and applications.

HISTORY

The ip command, including its maddress subcommand, is part of the iproute2 utility suite. iproute2 was developed to replace older net-tools utilities (like ifconfig, route, and netstat) on Linux, offering more advanced and consistent network configuration capabilities. Development began in the late 1990s, with Alexey Kuznetsov as a primary contributor. The ip maddress command provides a modern and robust way to manage multicast group memberships directly through the kernel's netlink interface, which has been critical for managing network configurations in various Linux-based systems, from servers to embedded devices.

SEE ALSO

ip(8), ip-link(8), ip-addr(8), netstat(8), ss(8)

Copied to clipboard