Most public Wi-Fi requires authentication through a portal page before accessing the Internet. For example, tvOS does not equip with a WKWebView (a.k.a browser), Apple TV will prompt a nearby iPhone / iPad to finish this process when it encounters Wi-Fi hotspots that require authentication. But what if, your device is not “Designed by Apple in California”?
Public Wi-Fi usually identifies a client by its MAC address. Once a MAC address is authorized, any device using that MAC address is allowed to Internet. MAC address is a unique identifier assigned to a wireless adapter for use in network communications and it will be broadcasted when connecting to Wi-Fi. However, the broadcasted MAC address is not unchangeable as long as the wireless adapter has provided an API to modify it. In recent years, Apple allows their user to avoid being tracked by using different MAC addresses across different Wi-Fi.
After understanding the underlying mechanics, we can use a Mac to help an IoT device complete this process. Take my Apple TV as an example. The first thing to do is figure out the MAC address of my Apple TV. It's usually printed on the bottom of the box or can be found in the OS's hardware info.
Then, change my Mac's MAC address to my Apple TV one. During this time, remember to turn off Apple TV's Wi-Fi to avoid collisions.
# disconnect current Wi-Fi hotspot
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z
# change MAC address
sudo ifconfig $wireless_nic ether $new_mac_address
Note: Use ifconfig
to figure out your wireless NIC.
Once you finish the authentication on Mac, you can revert its MAC address to default by the same command.