I was travelling on VIA Rail today, and wanted use the free onboard Wi-Fi. I connected my phone to it easily enough - they had a standard login page. But when I tried to connect my Mac to the wireless open network (VIA_WIFI_VIDEO) and tried navigating to a website, I got this:

Redirect loop page

As you can guess, what is happening is that when I try to connect to http://blog.shivankaul.com for the first time, the HotSpot tries to redirect me to the sign in page for the network. The sign in page seems to live at http://www.viarailwifi.ca. In the first redirect, the browser is redirected to following link:


which makes sense. However, for some reason, probably misconfiguration on their part, the redirected page continuously redirects to http://www.viarailwifi.ca. So the second time, the URL is redirected to:


and so on in an infinite loop until the browser kills it. I tried with Chrome, Brave and Safari with no luck. Some posts on the interwebz suggested clearing cache and cookies but that didn’t help.

I’m not sure why my phone (Moto G running Android 5.1) was able to connect, but given that it was, I just did the following to get Wi-Fi on my laptop -

  1. Disconnected my phone from the VIA Rail Wi-Fi

  2. Looked up my phone’s MAC address (Settings -> About -> Status for Android)

  3. Used a MAC spoofer to change my laptop’s MAC address to that of my phone’s. You can use any tool for this, but the command line tool I use is SpoofMAC. There’s a Node.js port as well (of course). Once it is installed, you can simply run:

$ sudo spoof set <your phone's MAC address> en0

en0 is the device on my laptop that is used for Wi-Fi. You can see a list of devices by running:

$ spoof list

It’s a pretty cute tool! If you want to reset your device’s MAC address after you’re done, simply run:

$ sudo spoof reset en0

Now I connected to VIA Rail’s Wi-Fi on laptop, and lookit, I gots internets!

What’s happening is that the HotSpot portal is using MAC addresses to remember devices so as to not annoy users by having them sign in to the Wi-Fi again and again. We can leverage that by masquerading our laptop as our phone. The downside is that you can’t use two devices with the same MAC addresses to connect to the HotSpot i.e. I wasn’t able to use my phone while using my laptop, which was unfortunate.

A better solution would be if I just didn’t get the redirect loop in the first place, but I couldn’t solve that. I emailed [email protected] - with some luck, next time I travel this will have been fixed!