Skip to content

Instantly share code, notes, and snippets.

@juliojsb
Last active February 2, 2024 14:33
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save juliojsb/00e3bb086fd4e0472dbe to your computer and use it in GitHub Desktop.
Save juliojsb/00e3bb086fd4e0472dbe to your computer and use it in GitHub Desktop.
Allow multicast communications in iptables
Run the following:
iptables -A INPUT -m pkttype --pkt-type multicast -j ACCEPT
iptables -A FORWARD -m pkttype --pkt-type multicast -j ACCEPT
iptables -A OUTPUT -m pkttype --pkt-type multicast -j ACCEPT
Or:
iptables -A INPUT -s 224.0.0.0/4 -j ACCEPT
iptables -A FORWARD -s 224.0.0.0/4 -d 224.0.0.0/4 -j ACCEPT
iptables -A OUTPUT -d 224.0.0.0/4 -j ACCEPT
@dacianstremtan
Copy link

Change this INPUT chain to allow inputs with the multicast destination

iptables -A INPUT -d 224.0.0.0/24 -j ACCEPT
or limit to multicast request from your own network only:
iptables -A INPUT -s <your_private_network_cidr> -d 224.0.0.0/24 -j ACCEPT
where <your_private_network_cidr> can be something like 192.168.1.0/24

@kobtsev-m
Copy link

Thanks a lot!

@hungkien05
Copy link

hungkien05 commented Jan 18, 2022

image

My network topology is shown in the picture. H1 will send multicast packet to H2 through R1 and R2. Which iptables rules should I set at R1 and R2 ?
Thanks in advance !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment