How to change DNS on Windows, Mac, Linux, Android, iPhone and a router

Pick a DNS server, write its addresses in the network settings of one device or of the router, and check that it answers. On Windows 11 it is Settings → Network & internet → your connection → DNS server assignment → Edit → Manual. On a Mac it is System Settings → Network → Details → DNS, on Android Private DNS, on an iPhone the (i) next to the Wi-Fi network. Set IPv6 addresses too if the network has IPv6, or part of the questions stays with the old server.

Updated

On this page

Before you change it

  • What it does. Another server answers “what address has this name”. It can be faster, filter ads or malware, or know names your provider's server doesn't. It doesn't change your IP address and doesn't encrypt anything by itself.
  • Take both addresses of one service. The second is a spare of the same kind. Mixing a filtering and an ordinary DNS gives a filter that works every other time.
  • One device or the whole home. A device keeps its setting on every network. A router gives it to everyone at home and nowhere else.
  • Write down what was there. Usually it is “automatic”, and the way back is to choose automatic again.
  • Leave the VPN adapter alone. While a VPN is on, its own DNS answers: change it in the VPN client.

Windows 11 and Windows 10: in the settings

  1. 1

    Open the connection

    Windows 11: Settings → Network & internet → Wi-Fi → Hardware properties, or Ethernet. A DNS set for the whole Wi-Fi adapter overrides one set for a single known network.

  2. 2

    Switch DNS to manual

    DNS server assignment (DNS settings in some builds) → Edit → Manual. Turn on IPv4 and type the Preferred DNS and the Alternate DNS, for example 1.1.1.1 and 1.0.0.1. Then the same for IPv6.

  3. 3

    Choose DNS over HTTPS

    Off is ordinary DNS. On (automatic template) works for servers Windows knows: Cloudflare, Google and Quad9 are on its list. On (manual template) takes an address such as https://dns.adguard-dns.com/dns-query. Fallback to plaintext lets questions go unencrypted when HTTPS fails.

  4. 4

    Windows 10

    Settings → Network & Internet → Change adapter options → right-click the connection → Properties → Internet Protocol Version 4 → Properties → Use the following DNS server addresses. The same in Version 6. Windows 10 has no DNS over HTTPS setting.

Windows: PowerShell

PowerShell as administrator. Put your adapter's name from the first answer in place of Wi-Fi.

Names and the current DNS
Get-NetAdapter
Get-DnsClientServerAddress
Set IPv4 and IPv6 servers at once
Set-DnsClientServerAddress -InterfaceAlias 'Wi-Fi' -ServerAddresses '1.1.1.1','1.0.0.1','2606:4700:4700::1111','2606:4700:4700::1001'
Clear-DnsClientCache
Windows 11: teach it one more DNS over HTTPS server
Add-DnsClientDohServerAddress -ServerAddress '94.140.14.14' -DohTemplate 'https://dns.adguard-dns.com/dns-query' -AllowFallbackToUdp $False -AutoUpgrade $True
Get-DnsClientDohServerAddress

With AutoUpgrade on, every adapter that uses this address speaks HTTPS to it. The second line shows the list Windows knows.

Undo
Set-DnsClientServerAddress -InterfaceAlias 'Wi-Fi' -ResetServerAddresses

Back to what the router gives.

macOS

System Settings → Network → Wi-Fi or Ethernet → Details → DNS: the plus under DNS Servers adds an address. The same in Terminal:

Set and check
networksetup -listallnetworkservices
sudo networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1 2606:4700:4700::1111
scutil --dns | grep nameserver

Addresses typed here are ordinary DNS. An encrypted one comes with an app or a configuration profile of the service.

Undo
sudo networksetup -setdnsservers Wi-Fi Empty

Empty returns DNS to automatic.

Linux

Where the network is run by NetworkManager (Ubuntu, Fedora, Mint, most desktops), set DNS in the connection. Where systemd-resolved answers, one file sets it for the whole system, with encryption.

NetworkManager
nmcli connection show
nmcli connection modify 'NAME' ipv4.dns '1.1.1.1 1.0.0.1' ipv4.ignore-auto-dns yes ipv6.dns '2606:4700:4700::1111' ipv6.ignore-auto-dns yes
nmcli connection up 'NAME'

Undo: the same with empty quotes after dns and no after ignore-auto-dns.

systemd-resolved, over TLS
sudo mkdir -p /etc/systemd/resolved.conf.d
printf '[Resolve]\nDNS=1.1.1.1#one.one.one.one 1.0.0.1#one.one.one.one\nDNSOverTLS=yes\nDomains=~.\n' | sudo tee /etc/systemd/resolved.conf.d/dns.conf
sudo systemctl restart systemd-resolved
resolvectl status

The name after # is checked in the certificate, ~. sends every name here. Undo: delete the file and restart the service.

Android and iPhone

  • Android, all networks at once: Settings → Network & internet → Private DNS → Private DNS provider hostname, for example dns.google or dns.quad9.net. It takes a name, not an address, and is always encrypted. To undo, choose Automatic. If the item isn't there, search the settings for “Private DNS”.
  • iPhone and iPad, one Wi-Fi network: Settings → Wi-Fi → the (i) next to the network → Configure DNS → Manual → Add Server, remove the old ones, Save. Repeat for each network. It doesn't work for mobile data.
  • iPhone, everywhere: an app or a configuration profile of the DNS service (since iOS 14) sets an encrypted DNS for Wi-Fi and mobile data. Take a profile only from the service's own site.

Router: the whole home

Open the router's page (often 192.168.0.1 or 192.168.1.1) and look in two places. In Internet or WAN, DNS is whom the router itself asks: devices go on asking the router. In LAN or DHCP, DNS is what devices get: they ask that server directly. One is enough; after a change in DHCP reconnect the devices. If the router hands out IPv6, its DNS is on a page of its own. Some providers lock these fields or answer port 53 themselves, and then only encrypted DNS on the device helps.

Check it, and what can go wrong

nslookup example.com prints the server that answered first. The DNS leak test on this site shows who really asks for you: if you see the new service there, the change works.

  • The test still shows the provider

    CauseIPv6 DNS is the old one, or the router asks the provider

    What to doSet IPv6 too; on a router look at both places

  • The test shows a third service

    CauseThe browser has its own secure DNS

    What to doTurn it off, or set the same service there

  • A hotel's or café's sign-in page doesn't open

    CauseThat page exists only in the network's own DNS

    What to doReturn to automatic, sign in, set it again

  • The printer, NAS or a work site is gone by name

    CauseThose names are known only to the router or the office

    What to doAutomatic DNS there, or their addresses

  • With the VPN on, nothing has changed

    CauseThe VPN's own DNS answers

    What to doChange it in the VPN client

  • Nothing opens at all

    CauseA typo, or the network doesn't let that server through

    What to doAutomatic, then another service

Sources

How we write and check

In Veli

In Veli the DNS of the tunnel is in the profile

While Veli is connected, the profile's DNS answers. To change it on a computer, open the profile's settings, the “Routes and DNS” tab. For WireGuard, AmneziaWG and OpenVPN the servers you type replace the ones from the file; an empty list means the VPN server's own. For VLESS, Trojan, Shadowsocks and other proxy protocols, questions go through the proxy to the first server on the list, 1.1.1.1 by default, and the address can be an encrypted one: https://…/dns-query, tls://… or quic://….

There is also “An ad and threat filter through DNS” in Settings → Security: AdGuard, AdGuard Family, Cloudflare 1.1.1.2 and 1.1.1.3, Quad9. It is off after install and works for profiles without their own DNS, from the next connection. Diagnostics → Privacy shows which DNS servers sites really see.

FAQ

How do I change DNS on Windows 11 to Google or 1.1.1.1?

Settings → Network & internet → your connection → DNS server assignment → Edit → Manual. Google is 8.8.8.8 and 8.8.4.4, Cloudflare 1.1.1.1 and 1.0.0.1; both work with the automatic DNS over HTTPS template.

Should I change IPv4 or IPv6 DNS?

Both, if the network has IPv6. Windows may ask either one, and an old IPv6 server goes on answering part of the questions.

Does changing DNS make the internet faster?

It can make sites start opening sooner, because the name is found faster. Downloads and the ping in games stay as they were.

Does changing DNS hide my IP address?

No. Sites see the same address, and the provider still carries the traffic. Only who answers for names changes.

How do I reset DNS to default?

Choose Automatic where you chose Manual. In PowerShell it is Set-DnsClientServerAddress with -ResetServerAddresses, on a Mac networksetup -setdnsservers Wi-Fi Empty.

The tunnel's DNS, set in the profile

Veli is a free client for Windows, macOS, Linux and Android. Your own DNS in a profile, encrypted too, filters by name, and a check of who really answers.