IGMP Proxy
CLI reference:/routing/igmp-proxy/routing/igmp-proxy/interface/routing/igmp-proxy/mfc
The Internet Group Management Protocol (IGMP) proxy forwards IPv4 multicast from one upstream interface to downstream interfaces, without a multicast routing protocol. It follows the IGMP-based forwarding model of RFC 4605 in these parts:
- On the downstream interfaces, the router is the IGMP querier: it sends IGMPv2 queries and learns from the membership reports which groups the receivers join.
- On the upstream interface, the router acts as a host: it sends membership reports for the groups that the receivers joined, so the upstream router or switch sends these groups to it.
- Multicast data that arrives on the upstream interface is forwarded to the downstream interfaces with receivers for the group.
A typical use is IPTV: the provider sends the TV channels (multicast groups) to the router's WAN interface, and the set-top boxes on the LAN join the channels they show. When the provider sends IPTV in a VLAN, the upstream interface is the VLAN interface. To limit the streams on the LAN to the bridge ports with receivers, also enable IGMP snooping on the bridge.
Compared to PIM-SM, the IGMP proxy is simpler to configure: it needs no multicast routing protocol and no rendezvous point. It is not suited for complex multicast routing: it has exactly one upstream interface, and it does not detect or avoid routing loops, so the topology must be a tree. The IGMP proxy handles IPv4 only. For IPv6 multicast, use PIM-SM.
The IGMP proxy is part of the main RouterOS package.
Forward IPTV from the WAN to the LAN
This example uses the default configuration: the WAN interface ether1 gets its address from the provider, and the
LAN bridge bridge has the address 192.168.88.1/24 and the LAN ports, with the set-top boxes. Add ether1 as the
upstream interface and bridge as the downstream interface. Both interfaces need an IP address: the router uses it as
the source of its IGMP messages.
/routing/igmp-proxy/interface
add interface=ether1 upstream=yes
add interface=
The default configuration firewall drops the IGMP queries of the upstream router (the input rule
defconf: drop all not coming from LAN) and the multicast streams from the WAN (the forward rule
defconf: drop all from WAN not DSTNATed). Accept IGMP and the multicast traffic that arrive on ether1, before
these rules:
/ip/firewall/filter
add chain=input action=accept protocol=igmp in-interface=ether1 \
comment="IGMP from upstream" \
place-before=[find comment="defconf: drop all not coming from LAN"]
add chain=forward action=accept dst-address=224.0.0.0/4 \
in-interface=ether1 comment="multicast from upstream" \
place-before=[find comment="defconf: drop all from WAN not DSTNATed"]
The IGMP reports of the receivers need no rule: they arrive on bridge, which is in the LAN interface list.
The downstream interface shows the querier settings it uses:
[admin@MikroTik] > /routing/igmp-proxy/interface/print
Columns: INTERFACE, UPSTREAM, THRESHOLD, ROBUSTNESS, QUERY-INTERVAL,
QUERY-RESPONSE-INTERVAL, LAST-MEMBER-QUERY-INTERVAL
# INTERFACE UPSTREAM THRESHOLD ROBUSTNESS QUERY-INTERVAL QUE LA
0 ether1 yes 1
1 no 1 2 2m5s 10s 1s
The set-top boxes join the channels themselves. To test without one, use a RouterOS device on the LAN as the receiver: join the group with the Group Management Protocol, and add a mangle rule that counts the packets that arrive for the group:
/ip/address
add address=192.168.88.10/24 interface=ether2
/routing/gmp
add groups=239.1.1.1 interfaces=ether2
/ip/firewall/mangle
add chain=prerouting action=passthrough \
dst-address=239.1.1.1 protocol=icmp
The sender in this example is 192.168.10.1 on the upstream network. In the lab, RouterOS ping to a multicast
group sent the packets with a time to live (TTL) of 1, which the IGMP proxy does not forward. On a RouterOS test
sender, set the TTL to 16 with a mangle rule, then ping the group:
/ip/firewall/mangle
add chain=output dst-address=239.1.1.1 action=change-ttl new-ttl=set:16
/ping 239.1.1.1 interface=ether2 count=3
When the receiver joined the group and the sender started the stream, the multicast forwarding cache (MFC) has an
entry for the source and the group. active-downstream-interfaces lists the interfaces with receivers, and bytes
and packets count the data received from the source:
[admin@MikroTik] > /routing/igmp-proxy/mfc/print detail
Flags: A - ACTIVE; D - DYNAMIC
0 AD group=239.1.1.1 source=192.168.10.1 upstream-interface=ether1
downstream-interfaces= active-downstream-interfaces=
bytes=168 packets=3 wrong-packets=0
The interface counters show the multicast data received on the upstream interface and sent on the downstream
interface, and state.querier=yes shows that the router is the querier on the downstream interface:
[admin@MikroTik] > /routing/igmp-proxy/interface/print detail
0 interface=ether1 upstream=yes threshold=1 alternative-subnets=""
.source-ip-address=192.168.10.2 .rx-bytes=168 .rx-packets=3 .tx-bytes=0
.tx-packets=0
1 interface= upstream=no threshold=1 alternative-subnets="" robustness=2
query-interval=2m5s query-response-interval=10s
last-member-query-interval=1s state.querier=yes
.source-ip-address=192.168.88.1 .rx-bytes=0 .rx-packets=0 .tx-bytes=168
.tx-packets=3 .robustness=2 .query-interval=2m5s
After the sender sent three packets, the receiver's counter shows them:
[admin@MikroTik] > /ip/firewall/mangle/print stats
Columns: CHAIN, ACTION, BYTES, PACKETS
# CHAIN ACTION BYTES PACKETS
0 prerouting passthrough 168 3
Accept streams from sources in other subnets
By default, the IGMP proxy forwards only data from sources in the subnets of the upstream interface. When the sender
is in another subnet, for example a provider's IPTV server behind several routers, the MFC entry has no upstream
interface and no downstream interfaces, and the data is not forwarded. The source of the entry is the address of
the sender, here 192.168.50.1:
[admin@MikroTik] > /routing/igmp-proxy/mfc/print detail
Flags: A - ACTIVE; D - DYNAMIC
0 AD group=239.1.1.1 source=192.168.10.1 upstream-interface=ether1
downstream-interfaces= active-downstream-interfaces=
bytes=168 packets=3 wrong-packets=0
1 AD group=239.1.1.1 source=192.168.50.1 upstream-interface=*FFFFFFFF
downstream-interfaces="" active-downstream-interfaces="" bytes=0
packets=0 wrong-packets=0
Add the sender's subnet to alternative-subnets on the upstream interface:
/routing/igmp-proxy/interface
set [find upstream=yes] alternative-subnets=192.168.50.0/24
The entry for the source then has the upstream and the active downstream interfaces:
[admin@MikroTik] > /routing/igmp-proxy/mfc/print detail
Flags: A - ACTIVE; D - DYNAMIC
0 AD group=239.1.1.1 source=192.168.50.1 upstream-interface=ether1
downstream-interfaces= active-downstream-interfaces=
bytes=168 packets=3 wrong-packets=0
You can also add static forwarding entries for a source and group in
/routing/igmp-proxy/mfc.
When the firewall drops IGMP or the streams
Without the two accept rules, the router does not answer the IGMP queries of the upstream router, and the streams do not reach the receivers. The MFC entry still counts the packets from the source, but the receivers get nothing, and the counters of the default drop rules grow:
Router
[admin@MikroTik] > /routing/igmp-proxy/mfc/print detail
Flags: A - ACTIVE; D - DYNAMIC
0 AD group=239.1.1.1 source=192.168.50.1 upstream-interface=ether1
downstream-interfaces= active-downstream-interfaces=
bytes=168 packets=3 wrong-packets=0
1 AD group=239.1.1.1 source=192.168.10.1 upstream-interface=ether1
downstream-interfaces= active-downstream-interfaces=
bytes=168 packets=3 wrong-packets=0
[admin@MikroTik] > /ip/firewall/filter/print stats where comment~"defconf: drop all"
Columns: CHAIN, ACTION, BYTES, PACKETS
# CHAIN ACTION BYTES PACKETS
;;; defconf: drop all not coming from LAN
0 input drop 2 298 15
;;; defconf: drop all from WAN not DSTNATed
1 forward drop 168 3
Receiver
[admin@MikroTik] > /ip/firewall/mangle/print stats
Columns: CHAIN, ACTION, BYTES, PACKETS
# CHAIN ACTION BYTES PACKETS
0 prerouting passthrough 0 0
With the accept rules, their counters show the accepted IGMP queries and the stream, and the receiver gets the packets:
Router
[admin@MikroTik] > /ip/firewall/filter/print stats where comment~"upstream"
Columns: CHAIN, ACTION, BYTES, PACKETS
# CHAIN ACTION BYTES PACKETS
;;; IGMP from upstream
2 input accept 88 3
;;; multicast from upstream
3 forward accept 168 3
Receiver
[admin@MikroTik] > /ip/firewall/mangle/print stats
Columns: CHAIN, ACTION, BYTES, PACKETS
# CHAIN ACTION BYTES PACKETS
0 prerouting passthrough 168 3
How the IGMP proxy behaves
- Upstream querier: the upstream interface answers the IGMP queries of a querier whose address is outside the
subnets of the interface.
alternative-subnetsis not needed for that. - One upstream interface: a second interface with
upstream=yesis rejected withfailure: only one upstream interface allowed. - IGMP versions on the upstream interface: the router sends IGMPv3 membership reports. When it receives IGMPv1 or IGMPv2 queries, it falls back to that version. It goes back to IGMPv3 when no IGMPv1 or IGMPv2 query has arrived for the older-version querier present timeout.
- IGMP version on the downstream interfaces: the router sends IGMPv2 queries. Receivers that support IGMPv3 answer with IGMPv2 reports. IGMPv2 reports carry no source addresses, so a receiver behind the IGMP proxy cannot ask for a group from specific sources.
- Query timers: the downstream interfaces use the
robustness,query-interval,query-response-intervalandlast-member-query-intervalvalues of/routing/igmp-proxy, unless the interface sets its own. - When the last receiver leaves a group, or a downstream interface is disabled, the router sends a leave report for the group on the upstream interface.
- Log: the IGMP proxy logs under the
igmp-proxytopic. The debug messages show each report and query it receives and sends, and each change of the MFC.
For all properties, see /routing/igmp-proxy,
/routing/igmp-proxy/interface and
/routing/igmp-proxy/mfc in the CLI reference.