LinuxCommandLibrary

ip-mroute

Display IP multicast routing cache information

SYNOPSIS

ip [ OPTIONS ] mroute { COMMAND | help }
COMMAND := { add | del | show | get | flush }
ip mroute add [ ... ]
ip mroute del
ip mroute show [ ] [ ] [ dev ] [ iif ]
ip mroute get
ip mroute flush [ ] [ ] [ dev ] [ iif ]

PARAMETERS

add
    Adds a multicast routing entry to the kernel's FIB. It requires:
- : The index or name of the interface on which multicast traffic for this route is expected to arrive.
- : The source IP address of the multicast stream. Use 0.0.0.0, *, or ANY for (*,G) (any source, specific group) entries.
- : The multicast group IP address.
- [ ... ]: One or more indices or names of interfaces to which the multicast traffic should be forwarded.

del
    Deletes a specific multicast routing entry. It requires the same parameters as add ( ) to uniquely identify the entry to remove.

show
    Displays the current multicast routing cache entries. Optional filters include:
- : Filter by source IP.
- : Filter by multicast group IP.
- dev : Filter by outgoing device.
- iif : Filter by incoming interface.

get
    Retrieves and displays a specific multicast routing entry matching the provided , , and .

flush
    Deletes all or selected multicast routing entries. Optional filters are the same as for show (, , dev , iif ) to specify which entries to flush.

/
    Refers to the network interface. Can be specified by its numerical ifindex or by its name (e.g., eth0, enp0s3). Use ip link show to find interface names and indices.


    The IP address of the multicast source. Use 0.0.0.0, *, or ANY for (*,G) entries.


    The multicast group IP address (e.g., 224.0.0.1).

DESCRIPTION

The ip mroute command is part of the iproute2 utility suite, used to manipulate the Linux kernel's multicast routing cache (FIB - Forwarding Information Base) entries. Unlike ip route, which manages unicast routes, ip mroute specifically handles forwarding rules for multicast packets. It allows administrators or multicast routing daemons to define how multicast traffic for a specific (Source, Group) or (*, Group) pair should be forwarded from an incoming interface to a list of outgoing interfaces.

While it can be used for manual configuration, its primary role is to provide a programmatic interface for user-space multicast routing protocols (like PIM, DVMRP, or static routing via smcroute) to populate and maintain the kernel's multicast forwarding state. This command is crucial for understanding and debugging multicast packet flow within a Linux system, offering insights into the kernel's active multicast forwarding decisions.

CAVEATS

ip mroute directly manipulates the kernel's multicast FIB. For complex multicast routing scenarios, it is generally recommended to use a user-space multicast routing daemon (like pimd or smcroute) that implements a multicast routing protocol. Manual entries added with ip mroute can conflict with a running daemon or be overwritten by it. Entries created using this command are not persistent across system reboots and will need to be re-added.

MULTICAST ROUTING CONCEPTS

Multicast routing differs from unicast routing by delivering packets to a group of recipients simultaneously. Kernel multicast routing entries specify an incoming interface (IIF), a source address (S), a group address (G), and a list of outgoing interfaces (OIFs). The kernel performs a Reverse Path Forwarding (RPF) check to ensure multicast packets arrive on the expected interface, preventing loops. Entries can be (S,G) for specific sources or (*,G) for any source to a given group.

INTERACTION WITH MULTICAST DAEMONS

While ip mroute allows direct manipulation, in production environments, multicast routing is typically managed by a daemon that implements a multicast routing protocol (e.g., PIM - Protocol Independent Multicast). These daemons dynamically create and manage the multicast routes in the kernel's FIB based on network topology and group memberships. ip mroute show is invaluable for verifying the state that these daemons have established.

HISTORY

The iproute2 utility suite, which includes ip mroute, was developed primarily by Alexey Kuznetsov. It was designed to replace older, less efficient, and fragmented network configuration tools like ifconfig, route, and netstat. Leveraging the Netlink socket API, iproute2 provides a unified, powerful, and modern interface for managing various aspects of networking in Linux, including advanced routing, traffic control, and multicast capabilities, making it a standard component of modern Linux distributions.

SEE ALSO

ip(8), ip-link(8), ip-route(8), pimd(8), smcroute(8), mrouted(8), netstat(8)

Copied to clipboard