LinuxCommandLibrary

ip-mroute

Display IP multicast routing cache information

SYNOPSIS

ip mroute { add | del } TO FROM iif INDEV [ oif OUTDEV ] [ table TABLE_ID ]
ip mroute { show | flush } [ table TABLE_ID ] [ from PREFIX ] [ to PREFIX ] [ iif DEVICE ]

PARAMETERS

add
    Install a new multicast route entry

del
    Remove an existing multicast route

show
    Display multicast routing cache entries

flush
    Clear all or filtered multicast routes

TO
    IPv4 multicast destination prefix (add/del)

FROM
    IPv4 source prefix (add/del)

iif DEVICE
    Input interface name (add/del/show)

oif DEVICE
    Output interface name (add only)

table TABLE_ID
    Specify routing table ID (all)

to PREFIX
    Filter show by destination prefix

from PREFIX
    Filter show by source prefix

DESCRIPTION

The ip mroute command, part of the iproute2 utilities, controls the Linux kernel's multicast routing cache. It enables configuration of static multicast forwarding entries, essential for directing IP packets from a source to multiple destinations efficiently. This is crucial for applications like streaming media, online gaming, and service discovery (e.g., mDNS, SSDP).

Multicast routes specify a destination group prefix (TO), source prefix (FROM), input interface (iif), and optional output interfaces (oif). These static entries supplement dynamic protocols like PIM-SM or IGMP/MLD proxying. The kernel maintains a forwarding cache derived from these routes, RPF checks, and hardware FIBs.

Use add and del for manual route management, show to inspect the cache with filters, and flush to clear entries. Supports multiple routing tables for VRFs or policy routing. Requires kernel multicast support and elevated privileges. Ideal for edge routers or lab testing multicast flows.

CAVEATS

Requires root or CAP_NET_ADMIN.
Kernel needs CONFIG_IP_MROUTE=y/m.
Static routes bypassed by dynamic protocols.
No IPv6 support (use ip6 mroute).

EXAMPLES

ip mroute add 239.0.0.1/32 192.168.1.10 iif eth0 oif eth1
Static route: src 192.168.1.10 to group 239.0.0.1, in eth0 out eth1.

ip mroute show table 100
List routes in table 100.

ip mroute flush table main
Clear main table cache.

FILES

/proc/net/ip_mr_cache: Kernel multicast cache view.
/proc/net/ip_mr_vif: Virtual interfaces.
/proc/net/fib_trie: Related FIB info.

HISTORY

Developed in iproute2 by Alexey Kuznetsov ~1996-1999. Tied to Linux kernel multicast since 2.2 (ip_mroute module). Enhanced for multiple tables in 2.6+, VRF in 3.x kernels.

SEE ALSO

ip(8), ip-route(8), ip-neighbour(8), ss(8)

Copied to clipboard