Putorius
Linux Quick Tips

Chromecast From a Linux PC - Allow Multicast on Firewall

How to Fix Chromecast on Linux PC

Google's Chromecast is a great tool. I use it to cast a browser tab with stock updates to my TV while I work. However, if you are running a Linux PC you might have ran into the "No Devices Found" error. In this Linux quick tip we will show you how to connect to your Chromecast devices from Linux simply by allowing inbound multicast packets.

Which firewall you have is highly dependant on what distribution of Linux you are running. While I cannot cover every possible scenario, I will show you how to allow multicast packets on the most popular firewalls.

Allow Mutlicast in IPTables

IPTables has been around for a long time. Over the last couple of years most distros have switched over to more (supposedly) user friendly options like firewalld, ufw, or nftables. However, if you are like me and disable firewalld and use iptables, here is how you allow multicast packets.

sudo iptables -I INPUT -m pkttype --pkt-type multicast -j ACCEPT

The above will allow any inbound packet with the type of multicast. You can tighten it up by allowing it only from your local network. For example, my home network is 10.0.0.0/24 so I would use that as the source address like so.

sudo iptables -I INPUT -s 10.0.0.0/24 -m pkttype --pkt-type multicast -j ACCEPT

If you want, you can also allow only the specific IP address of the chromecast device.

To learn more about iptables read "The Basics of IPTables - Opening Ports on the Linux Firewall".

Allow Multicast in Firewalld

Fedora and other Red Hat variants use firewalld by default. Firewalld is just a new "frontend" for iptables. It uses the firewall-cmd command to manage it's rule set. Here is an example of allowing multicast traffic on firewalld.

sudo firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -m udp -p udp -m pkttype --pkt-type multicast -j ACCEPT

To learn more about firewalld read "Introduction to Firewalld Basics".

Allow Multicast in UFW

UFW or Uncomplicated Firewall is the default on Debian and Ubuntu systems. It is a yet another frontend for iptables that is supposed to be more user friendly. Here is an example of how to allow multicast traffic on your Ubuntu system using UFW.

sudo ufw allow in proto udp to 224.0.0.0/4

To learn more about UFW read "Introduction to UFW Basics - The Uncomplicated Firewall".

Conclusion

Once you open multicast on your host firewall all your Chromecast devices should now be discoverable. You may have to close Chrome and open it back up to see the devices.

More Reading on Multicast

Exit mobile version