Skip to content

Instantly share code, notes, and snippets.

@joegasper
Created April 2, 2018 01:03
Show Gist options
  • Save joegasper/49741d71d8a3f52bb5d965a852feb24f to your computer and use it in GitHub Desktop.
Save joegasper/49741d71d8a3f52bb5d965a852feb24f to your computer and use it in GitHub Desktop.
Set Windows client to use CloudFlare DNS Service 1.1.1.1
#See: https://1.1.1.1/ and https://www.cnet.com/news/cloudfare-new-1111-dns-privacy-tool-would-speed-your-internet-too/
#Run in elevated PowerShell command shell
#Store current DNS servers
Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | Get-DnsClientServerAddress | Select ServerAddresses -expand ServerAddresses | Set-Content -Path $env:USERPROFILE\OriginalDNSservers.txt
$Display current DNS servers
Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | Get-DnsClientServerAddress
#Specifiy CloudFlare 1.1.1.1 service IP addresses (IPv4/IPv6)
$DNSservers = ('1.1.1.1','1.0.0.1','2606:4700:4700::1111','2606:4700:4700::1001')
#Set client DNS servers to CloudFlare DNS servers
Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | Set-DnsClientServerAddress -ServerAddresses $DNSservers
#Display updated DNS servers
Get-NetAdapter -Physical | Where-Object {$_.Status -eq 'Up'} | Get-DnsClientServerAddress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment