Skip to content

Instantly share code, notes, and snippets.

@rskelley9
Last active October 31, 2023 10:28
Show Gist options
  • Save rskelley9/e9fbfe02147cd8f9f7f9 to your computer and use it in GitHub Desktop.
Save rskelley9/e9fbfe02147cd8f9f7f9 to your computer and use it in GitHub Desktop.
Workaround: Connect your Chromecast to a Hotel Wireless Network

About

I recently relocated for new employment. I've been staying in an extended stay hotel for about 3 weeks now. The hotel I'm staying in gives its guests free Wifi access. However, it requires users to accept terms and conditions on a splash page via browser interface before they can use the network. This makes it difficult to use my Chromecast with the network, as it doesn't have a means of accessing that splash page. While I could call the IT help line, I decided to explore a work-around.

Like many networks, my hotel's network attempts to improve security by using MAC address filtering. Luckily, Mac OS X (10.4 - 10.10) makes it very easy to spoof your network card's MAC address.

Here's how to add a devices like Chromecast, AppleTV, Roku to a wireless network that requires a browser to authenticate and accept terms and conditions.

Before You Start

You'll need two things besides the device you want to connect to the network, (1) your laptop and (2) some Unix shell flavor.

If you don't have any idea what a MAC address is, see my Gist on MAC Address Spoofing. Really, there are just two important points you should know about MAC addresses before proceeding:

1.) MAC addresses are 48-bit, factory-assigned, hexadecimal uids used for organizing a physical network.

2.) MAC addresses will typically be reset once your computer/device reboots.

Steps

1.) Open up Terminal.app and run the following command to list your machine's active network interface:

# Should output something like 'en0' or 'en1' depending on wireless/wired connection
$ ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active' | egrep -o -m 1 '^[^\t:]+'

2.) Show the MAC address for the interface name you retrieved in step 1, en0 in this example:

$ ifconfig en0 | grep ether

3.) Store that value in a variable so you can easily set your MAC address back to its original value without rebooting your computer.

mymac=$(ifconfig en0 | grep ether)

4.) Turn your chromecast/other device on and configure it to connect to the network. Find the devices MAC address and copy it down.

5.) Disconnect your computer from the network and turn off your wireless controller:

# First disassociate from your wireless network
$ sudo airport -z

# Then turn the network interface controller (NIC) off
$ sudo ifconfig en0 down

Note: If you receive an error like airport: command not found, no worries, an alternative approach is to simply toggle your airport via the GUI. You can do the same for your ethernet interface.

6.) Turn your NIC back on, and set your the your network card's MAC address to the Chromecast's (xx:xx:xx:xx:xx:xx in this example):

# Turn on the NIC
$ sudo ifconfig en0 up

# Change MAC address of your computer to Chromecast's
$ sudo ifconfig en0 xx:xx:xx:xx:xx:xx

Note: If you get a 'bad value' message or your MAC address isn't being set to the new value you generated, you may have to specifiy another name for the interface.

# Try using 'ether' for OS X 10.9 and 10.10
$ sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx

# Try using 'Wi-Fi for OS X prior to 10.8'
$ sudo ifconfig en0 Wi-Fi xx:xx:xx:xx:xx:xx

7.) Turn off your Chromecast. Then, open your laptop's browser, accept the splash page terms and conditions and log onto the network while using the Chromecast's MAC address.

8.) Repeat step 5, disassociating from the network on your laptop and turning the NIC off.

9.) Turn your Chromecast on, and it should automatically connect to the wireless network.

10.) On your laptop, change your MAC address back to its default:

sudo ifconfig en0 ether ${mymac}

Also...

  • Use arp -a -n to list all of the machines on your LAN. This should out their MAC and their IP/Host. You can probably guess why this is useful...
@akira712
Copy link

akira712 commented Nov 8, 2016

Thanks for this, BTW works for Google Home as well.

@mattmanpro
Copy link

Thank you so much for this! I was able to get my Apple TV up and running on hotel wifi thanks to this. I'm not a coder at all, but I am a digital native and I was able to follow this so thank you.

For me there were a few hiccups I had to work out and I thought I'd share some resources in case anyone else had the same problems.

  1. When I pasted the first line into terminal, I got the error message "bash: pcregrep: command not found." Apparently the PCRE (Perl Compatible Regular Extensions) library was not installed. Following these instructions solved that for me.

  2. The same thing happened in step 5 with the "airport" command, where I got a "command not found" error. I did some googling and found this, which ran me into another error saying I "wasn't permitted" to access the /usr folder. The work-around for this was disabling rootless mode. But it seems like all this is doing is disconnecting you from the wifi network and turning off Airport (right?), which can be done easily without Terminal, so I could actually have skipped that hassle with this, I think.

Hope this helps someone :)

@mahomedgp
Copy link

Thank a lot rskelley9. I was also able to get my Apple TV connected.

@mattmanpro - both your steps helped me out. your suggestion to disconnect from the wifi network saved me disabling rootless mode (basically I removed the WiFi network from my list preventing it from auto connecting and manually turned my WiFi off to complete Step 5).

@hroman-codes
Copy link

@mattmanpro thanks for that alternate approach and explanation for step 5. It worked like a charm and got my Apple TV working! 👍

@rskelley9
Copy link
Author

@mattmanpro thanks for bringing this to light, I included a note and some links to disconnect via the gui as you did.

@iamromanh, @mahomedgp, @akira712 I appreciate the positive feedback and suggestions, thanks guys!

@DeFilippis
Copy link

If you run into the problem "bad value" using High Sierra, manually disassociate from the device like so:

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z

and then

sudo ifconfig en0 ether A5:74:33:82:16:12

Doing it through the GUI did not work for me. Also note the importance of using ether.

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