The Google Chromecast does not support WiFi networks with captive portals (e.g. hotel WiFi) or WPA2-Enterprise/802.1X username/password authentication (e.g. eduroam or other enterprise entworks). This presents a problem when wired internet is not readily available and we do not want to use our mobile data.
In theory, it should be possible to create a WiFi hotspot from an existing connection, but this is difficult when the existing connection is itself WiFi and takes up a WiFi network card. There are a number of theoretical options, but I had great difficulty with them. To save you the trouble, here is the method that worked for me:
Use the controlling smartphone to connect to the protected WiFi network. Use USB tethering to share the connection with a spare laptop (or other WiFi-enabled computer). Use the laptop to create a WiFi hotspot in bridge mode.
This approach works for both initial setup of the Chromecast, and for controlling and streaming media.
Connect to the protected WiFi network on the smartphone, and complete the captive portal or login sequence as appropriate.
Connect the smartphone to the spare laptop, and enable USB tethering on the smartphone. On Android, go to Settings → Network & internet → Hotspot & tethering and enable USB tethering. This should also be possible on iOS, but I do not have an iOS device to test.
Use the laptop to create a WiFi hotspot in bridge mode. On Arch Linux, this can be easily accomplished using the create_ap package, running e.g.
sudo create_ap -m bridge wlp2s0 enp0s20u1 ChromecastAP wifipassword, where wlp2s0 and enp0s20u1 are the relevant network devices from
ip link, and ChromecastAP and wifipassword are the SSID and password you choose for the new hotspot.
Important: The WiFi hotspot must be created in bridge mode, not NAT mode. Bridge mode will enable the smartphone and Chromecast to see each other on the same network, whereas NAT mode will prevent the smartphone from communicating directly with the Chromecast.
Now start the Home app on the smartphone, and choose the option to set up a new device. (If your Chromecast has already been set up and you cannot connect to it, you will need to perform a factory reset by holding down the button on the side.)
Set up the device as usual, and when asked to select a WiFi network, choose the ChromecastAP WiFi hotspot you created earlier. You will be warned that the smartphone will disconnect from the current WiFi network and connect to ChromecastAP once setup is complete. This is fine.
The Chromecast should now connect to the ChromecastAP network. Because the smartphone has disconnected from the real WiFi network, the Chromecast should report ‘Check internet connection’ and advise that there is no internet connectivity. To solve this, simply return to the smartphone and reconnect to the protected WiFi network. Once the Chromecast detects this, it should proceed to the ‘Almost done!’ screen, and you should be able to continue setting up your Chromecast in the Home app.
You should now be able to cast media to the Chromecast from your smartphone as usual.
Notes on approaches that didn't work
I was not able to have the smartphone and Chromecast connect to a WiFi hotspot created from another computer (with an Ethernet connection). While the setup worked correctly, the Home app on the smartphone was not then able to see the Chromecast on the same network, even though other apps worked correctly.
I tried doing the reverse of this article, connecting to the protected network using the laptop, using GNirehtet over USB to reverse tether the smartphone to the laptop connection, and using the smartphone to create a WiFi hotspot for the Chromecast. However, GNirehtet does not support ICMP/ping, and this presumably caused the Chromecast to believe it was not connected to the internet, even though it was.