Created
May 13, 2019 22:24
-
-
Save todd-a-jacobs/397c632facc1022f4f2ee4693a78641a to your computer and use it in GitHub Desktop.
Enable Cloudflare DNS (1.1.1.1) on macOS Wi-Fi interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Purpose: | |
# Use Cloudflare's 1.1.1.1 DNS service on macOS from the command line. | |
# There's no Cloudflare client for the Mac to make switching easier. | |
# Author: | |
# Todd A. Jacobs | |
# Copyright: | |
# Copyright 2019 Todd A. Jacobs | |
# License: | |
# GPLv3 or later | |
old_dns=$(networksetup -getdnsservers Wi-Fi) | |
networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001 | |
new_dns=$(networksetup -getdnsservers Wi-Fi) | |
echo -e "New DNS\n------- \n$new_dns" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment