Saturday, April 4, 2020

Unlimited WIFI in the Cafe

Seattle cafe culture lives up to the hype. For centuries in America people have spent most of their lives in three places: Home, work, and church. With the rise of atheism and non-participatory religiosity, many people now look elsewhere for their 'third place', and Seattlites have settled on the cafe.

After living in Seattle for nearly five years, I myself have fallen deeply into this pattern. The cafe is the perfect place where you can sit comfortably (but not too comfortably) in an open rustic atmosphere that is quiet (but not too quiet) while you have a conversation with friends, or work on some kind of individual project. The cafe is where you'll find Seattlites reading their books, going on dates, editing their photos, coding up new iPhone apps, writing blog posts, or sitting in silent meditation. Here, the cafe is the new church, and communion is done with coffee instead of wine.




Last summer I made a cross country flight to the east coast for a internship in Boston. Being entrenched as I am in the Seattle cafe culture, imagine my surprise to arrive on the east coast and find that there are not cafes every third block. There are cafes in Boston if you know where to look and who to ask, but the cafes I did find seemed to want you in and out — no lollygagging is permitted on the east coast. Many Boston cafes don't even have internet and others that do have a two hour timer after which they will shut off your connection.

Well I want to stay for a while... And I want my internet, my latte, and a biscuit too. Needless to say, I got a bit fed up with this two hour WIFI policy.

At one point, in a local cafe while casually browsing the web, I noticed my two hours were almost up, but this time I decided to use my remaining 28 minutes of cafe WIFI to investigate how the cafe turns off the WIFI to my computer, and find a way to stay online. I found out that for most cases, the implementation turns out to be quite simple and easy to get around. The router starts a timer associated with computer's MAC address when you initially connect, after the time elapses the router stops accepting any network packets with your computer's MAC address.

What is a MAC Address?


MAC in this context has nothing to do with Apple computers. In the field of computer networks, MAC is the acronym for 'Media Access Control'.

It is a unique identification number assigned to every piece of networking hardware. The address is baked into the networking components of any device, and is guaranteed to be unique. No one else in the world has a device with the same MAC address as whatever device you are using to read this blog post from. At least, that should be the case. Very rarely, device manufacturers can make a mistake and assign an already used MAC address to a new device.

Since multiple manufacturers are involved in making networkable devices, they all have to cooperate on a standard to ensure that two different organizations don't make a device with the same MAC address by accident. This is done by the adoption of a unique 'organizational prefix' by each manufacturer, which is prefixed to all MAC addresses on the devices they make. Then, manufacturers can use any scheme they want with the remaining bytes to ensure their addresses are unique.

Most importantly about MAC addresses: they can easily be spoofed!

Spoofing MAC Address to Remain on Cafe WIFI


Adopting a different address will appear to the cafe's router as though you just took out a new computer that has not yet connected to the network. By spoofing yourself a new MAC address every two hours, you can continually get another two hours of WIFI anytime you run out.

Linux


On most Linux distributions, the process should be straightforward. For my Manjaro Linux OS, I did the following steps:

1. Check what my current MAC address is for my wireless network interface,

> ip link show 
This command might output data about a lot of network interfaces depending on how many your computer has, but we are looking for the wireless interface which should have a name starting with 'wl'. 
> wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
link/ether 34:02:86:4b:84:60 brd ff:ff:ff:ff:ff:ff 
Under that interface, look for the 'link/ether' label, 
> link/ether 34:02:86:4b:84:60
This is the current and original MAC address of your wireless interface, make note of this for later!

2. Shut down the network interface temporarily,

> ip link set dev <interface> down 
where <interface> is replaced with the name of your wireless network interface. For me, 
> ip link set dev wlo1 down

3. Set a new MAC address,

> ip link set dev <interface> address <XX:XX:XX:XX:XX:XX>
One way to choose your new MAC address is to just increment the number by one. If you didn't know, these addresses are actually integers, just displayed in a hexadecimal notation
You could make your MAC address any value, but its wise to not change the three highest order (leftmost) bytes, since those bytes form the vendor prefix mentioned earlier. Some routers may not allow connections from interfaces with invalid prefixes. 
For me, incrementing my original address by one, 
> ip link set dev wlo1 address 34:02:86:4b:84:61

4. Bring the network interface back up,

> ip link set dev <interface> up 
Now you should be back online! After you're done at the cafe, set your MAC address back to its original value following the same steps.

Windows and Mac


For OS X and windows, similar methods exist. Linked are tutorials for these,

In general, this strategy should work perfectly to keep you online in a cafe or other timed WIFI scenario. However there is one way it could go awry. Earlier I mentioned that every device's MAC address is unique according to the cooperative standard followed by device manufacturers. By manually spoofing your device's MAC address, you run the risk of a MAC address conflict if someone else on the same WIFI just happens to have the MAC address which you switched to. If that does happen, then the WIFI will cease to work correctly for either of you, but fortunately such an event is incredibly unlikely. There are 281,474,976,710,656 possible MAC addresses to choose from, and only around 6,000,000,000 total existing computers.

In order for such a conflict to happen in the cafe while using the incremental strategy, there would have to be another device that has a network interface with the same hardware manufacturer as your devices network interface, and that person would have to have the exact same address of 8,388,607 possible addresses for that manufacturer. It's safe to say this would probably not happen, but if it does, you can just select a new MAC address and keep browsing.

No comments:

Post a Comment