Using Cloudflare Gateway to Stay Productive (and turn off distractions) While Working Remotely
This week, like many of you reading this article, I am working from home. I don’t know about you, but I’ve found it hard to stay focused when the Internet is full of news related to the coronavirus.
CNN. Twitter. Fox News. It doesn’t matter where you look, everyone is vying for your attention. It’s totally riveting…
… and it’s really hard not to get distracted.
It got me annoyed enough that I decided to do something about it. Using Cloudflare’s new product, Cloudflare Gateway, I removed all the online distractions I normally get snared by — at least during working hours.
This blog post isn’t very long, but that’s a function of how easy it is to get Gateway up and running!
To get started, you’ll want to set up Gateway under your Cloudflare account. Head to the Cloudflare for Teams dashboard to set it up for free (if you don’t already have a Cloudflare account, hit the ‘Sign up’ button beneath the login form).
If you are using Gateway for the first time, the dashboard will take you through an onboarding experience:
The onboarding flow will help you set up your first location. A location is usually a physical entity like your home, office, store or a data center.
When you are setting up your location, the dashboard will automatically identify your IP address and create a location using that IP. Gateway will associate requests from your router or device by matching requests with your location by using the linked IP address of your location (for an IPv4 network). If you are curious, you can read more about how Gateway determines your location here.
Before you complete the setup you will have to change your router’s DNS settings by removing the existing DNS resolvers and adding Cloudflare Gateway’s recursive DNS resolvers:
How you configure your DNS settings may vary by router or a device, so we created a page to show you how to change DNS settings for different devices.
You can also watch this video to learn how to setup Gateway:
Next up, in the dashboard, I am going to go to my policies and create a policy that will block my access to distracting sites. You can call your policy anything you want, but I am going to call mine “Deep work.”
And I will add a few websites that I don’t want to get distracted by, like CNN, Fox News and Twitter.
After I add the domains, I hit Save.
If you find the prospect of blocking all of these websites cumbersome, you can use category-based DNS filtering to block all domains that are associated with a category (‘Content categories’ have limited capabilities on Gateway’s free tier).
So if I select Sports, all websites that are related to Sports will now be blocked by Gateway. This will take most people a few minutes to complete.
And once you set the rules by hitting ‘Save’, it will take just seconds for the selected policies to propagate across all of Cloudflare’s data centers, spread across more than 200 cities around the world.
How can I test if Gateway is blocking the websites?
If you now try to go to one of the blocked websites, you will see the following page on your browser:
Cloudflare Gateway is letting your browser know that the website you blocked is unreachable. You can also test if Gateway is working by using dig or nslookup on your machine:
If a domain is blocked, you will see the following in the DNS response
This means that the policy you created is working!
And once working hours are over, it’s back to being glued to the latest news.
If you’d rather watch this in video format, here’s one I recorded earlier:
And to everyone dealing with the challenges of COVID-19 and working from home — stay safe!