From KHicks
Jump to navigation Jump to search
A Chromecast device

From Wikipedia:

Chromecast a digital media player developed by Google. The device, a 2.83-inch (72 mm) HDMI dongle, plays audio/video content on a high-definition television or display by directly streaming it via Wi-Fi from the Internet or a local network. Users select the media to play using mobile apps and web apps that support the Google Cast technology. Alternatively, content can be mirrored from the Google Chrome web browser running on a personal computer, as well as from the screen of some Android devices.

Cast to multiple networks

Natively, a Chromecast device can only be discovered by other devices within its own broadcast domain, meaning that it cannot be discovered on other networks (a guest network, for example). However, there is a way to make a Chromecast discoverable on a different network by having a single node exist on both networks and forward multicast traffic between them (or at least from the Chromecast's network to the destination network; all communication between devices after discovery are unicast).


In this tutorial, we will be using Avahi, a free tool that forwards multicast traffic across network interfaces. Our environment will consist of an Ubuntu machine with two network interfaces:


The Chromecast device will exist in the (trusted) network, and we will allow for users in the (guest) network to discover and connect to it. For information on configuring the network interfaces, see here. You can also optionally install an SSH server on this machine and only listen on the interface facing the trusted network.

Install Avahi

First thing's first. Make sure all apt repositories are up to date:

   $ sudo apt-get update

Install the needed Avahi packages:

   $ sudo apt-get install avahi-daemon avahi-utils

Open the file at /etc/avahi/avahi-daemon.conf for editing and configure it with these settings:


Restart the service for the settings to take effect:

   $ sudo service avahi-daemon restart

View the currently active network services to make sure that everything is working. Each Chromecast device should be visible on both networks.

   $ avahi-browse -a

Workaround for missing devices

In my experience, I have noticed that Chromecast devices are only discoverable briefly after the avahi-daemon service is started. This is acceptable if you don't mind restarting the daemon (see above) every time you have a guest connect to your Chromecast, but others may not want to babysit the server so frequently. To fix this, I have found a workaround that will restart the service at regular intervals.

Open root's cron entries:

   $ sudo crontab -e

Append these lines to the end of the file:

   * * * * * /usr/sbin/service avahi-daemon restart
   * * * * * ( sleep 15; /usr/sbin/service avahi-daemon restart )
   * * * * * ( sleep 30; /usr/sbin/service avahi-daemon restart )
   * * * * * ( sleep 45; /usr/sbin/service avahi-daemon restart )

After the file is saved and closed, the server will restart the avahi-daemon service every 15 seconds. Of course, you can adjust the frequency to your liking by tweaking these settings. Restarting the service so frequently should not introduce any problems, because once a Chromecast device is detected (which takes well less than 15 seconds), all connections with it once the guest selects it are unicast.

This workaround will cause avahi-browse -a to exit every 15 seconds due to the service restarting, but you can simply run the command again to see the discovered devices.


Ensure that your firewall allows for traffic between the guest network and your Chromecast device to communicate. Once the Chromecast is discovered by the guest device, the Avahi service is no longer involved; they instead communicate directly.