DNS & Domain Names

How to Change DNS Servers on Windows, Mac, Phone and Router

Step-by-step directions for changing DNS servers on Windows, macOS, Linux, iPhone, Android and your router, plus how to undo it.

Key takeaways

  • Changing the router covers devices that accept its settings; changing a device overrides the router for that device only.
  • Enter both a primary and a secondary address, and include IPv6 addresses if your network uses IPv6.
  • Android's Private DNS setting takes a hostname, not an IP address.
  • Write down the old values first, and return to automatic if anything stops working.

To change DNS servers, open the network settings for the connection you use, switch DNS from automatic to manual, enter the addresses of the resolver you want and reconnect. Do it on a single device to affect only that device, or on your router to cover most of your home at once.

The whole job takes a few minutes and is easy to reverse. Menu names differ between versions and manufacturers, so treat the paths below as a map and look for the closest match on your screen.

Before you start

Get these ready:

  • The new addresses. Take them from the resolver operator's own documentation. The commands below use the placeholders 192.0.2.53 and 192.0.2.54; replace them with real ones.
  • IPv6 addresses, if your connection has IPv6. If you set only IPv4, many devices keep sending some lookups to the old IPv6 resolver.
  • The current values, written down or photographed.
  • Any special requirements. A work or school device may be managed, and a VPN may supply its own DNS.

If you have not decided which resolver to use, read whether you should change resolvers first.

Where should you make the change?
Do you want it to follow one device to other networks? YES Set it on that device, ideally with encrypted DNS. 1 NO Do you want every home device covered? YES Set it on the router that hands out network settings. 2 NO Does your provider's router lock the DNS fields? YES Set each device, or use your own router behind it. 3 NO Start with one device Test there for a few days before changing the whole network. Do you want it to follow one device to other networks? 1 IF YES Set it on that device, ideally with encrypted DNS. NO Do you want every home device covered? 2 IF YES Set it on the router that hands out network settings. NO Does your provider's router lock the DNS fields? 3 IF YES Set each device, or use your own router behind it. NO Start with one device Test there for a few days before changing the whole network.

Windows

In Windows 11, using the Settings app:

  1. Open Settings, then Network & internet.
  2. Select Wi-Fi or Ethernet, then the properties of the active connection.
  3. Next to DNS server assignment, choose Edit.
  4. Switch from Automatic to Manual and turn on IPv4, then IPv6 if you use it.
  5. Enter the preferred and alternate addresses, and save.

If your version shows a DNS over HTTPS choice beside each address, you can enable encryption there for resolvers that support it. Windows 10 uses a similar path through adapter properties, under the settings for Internet Protocol Version 4 and Version 6.

From an administrator PowerShell window, you can do the same:

Get-NetAdapter
Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi" -ServerAddresses ("192.0.2.53","192.0.2.54")
Get-DnsClientServerAddress -InterfaceAlias "Wi-Fi"
Clear-DnsClientCache

Use the adapter name that Get-NetAdapter shows. To return to automatic:

Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi" -ResetServerAddresses

macOS

In recent versions:

  1. Open System Settings, then Network.
  2. Select your active connection and open Details.
  3. Choose DNS in the sidebar.
  4. Use the add button to enter each server address, then remove or leave unneeded entries and confirm.

In Terminal:

networksetup -listallnetworkservices
networksetup -getdnsservers Wi-Fi
sudo networksetup -setdnsservers Wi-Fi 192.0.2.53 192.0.2.54
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

To undo it:

sudo networksetup -setdnsservers Wi-Fi Empty

Linux

Most desktop distributions let you set DNS in the network settings panel, under the IPv4 and IPv6 tabs for a connection, with the automatic DNS switch turned off. On systems managed by NetworkManager, the command line works too:

nmcli connection show
sudo nmcli connection modify "Home" ipv4.dns "192.0.2.53 192.0.2.54" ipv4.ignore-auto-dns yes
sudo nmcli connection up "Home"
resolvectl status

Replace Home with your connection's name. resolvectl status applies to systems using systemd-resolved. Editing /etc/resolv.conf by hand is often overwritten automatically, so use the tool that manages it.

iPhone and iPad

For a single Wi-Fi network:

  1. Open Settings, then Wi-Fi.
  2. Tap the information button next to your network.
  3. Tap Configure DNS and choose Manual.
  4. Delete the existing entries, add the new servers and save.

This setting applies to that Wi-Fi network only, and not to cellular data. For system-wide encrypted DNS, some resolver operators provide an app or a configuration profile. A profile is powerful, so install one only from an operator you trust.

Android

Android versions and manufacturers differ, but most recent phones offer Private DNS, often under Settings, then Network & internet or Connections.

  1. Open Private DNS.
  2. Choose the option to enter a provider hostname.
  3. Type the hostname from the resolver's documentation, in the form dns.example.com.
  4. Save.

This uses DNS over TLS and applies on Wi-Fi and mobile data. If the hostname is mistyped or the network blocks the service, you may lose connectivity until you set it back to automatic. To use plain IP addresses instead, you usually have to edit one Wi-Fi network, switch its IP settings to static and fill in the DNS fields, which is fussier and easy to get wrong.

Your router

Changing the router is the broadest option. First log in to the router's admin page.

  1. Find the settings for LAN, DHCP, Internet or WAN.
  2. Look for DNS server fields. A router may have two places: the DNS it uses itself (WAN side) and the DNS it hands to devices (DHCP side).
  3. Enter primary and secondary addresses, plus IPv6 ones if there are fields for them.
  4. Save, and restart the router if asked.
  5. Reconnect your devices so they pick up the new settings.
How a router change reaches your devices
1 Edit the router Enter the new DNS addresses and save. 2 Devices renew Each gets fresh settings when its lease renews or it reconnects. 3 Caches clear Old answers expire, or you flush them. 4 Verify Check one device to see which server answers. Edit the router Enter the new DNS addresses and save. 1 Devices renew Each gets fresh settings when its lease renews or it reconnects. 2 Caches clear Old answers expire, or you flush them. 3 Verify Check one device to see which server answers. 4

Some provider-supplied routers do not allow DNS changes. Your choices then are per-device settings or your own router. If your router instead names itself as the DNS server and forwards upstream, that is normal; devices will show the router's local address.

Which setting wins

A single device can hold several DNS settings at once, and knowing the usual order of precedence explains most surprises.

Setting Scope Typically overrides
Router DHCP DNS Every device that accepts automatic settings The provider's default
Manual DNS on a device That device or that network profile The router
System-wide encrypted DNS All apps on the device Plain manual and automatic entries
Browser secure DNS That browser only The system setting
VPN DNS Traffic while the VPN is connected Most local settings

Exact behavior depends on the software, so verify with a test instead of assuming. The practical rule: the closer a setting is to the application, the more likely it wins.

This also matters for filtering. If you set a family-friendly resolver on the router, a device with its own manual DNS or a browser with its own secure DNS will not use it. On your own household's devices you can check each of these places.

Choosing primary and secondary addresses

Most operators publish a pair of addresses. Enter both. The second entry gives your device somewhere to turn if the first does not respond.

Do not think of it as a strict backup, though. Some systems alternate between entries or switch to the second and stay there. So both should behave the same way: same operator, same filtering level and same knowledge of any local names. A mismatched pair produces faults that come and go, which are the hardest kind to track down.

If your connection has working IPv6, repeat the exercise with the operator's two IPv6 addresses. To find out whether it does, see how to check for working IPv6.

Turning on encryption while you are there

Changing the address alone leaves queries unencrypted. If your system supports it, enable the encrypted option at the same time:

  • Windows 11 offers DNS over HTTPS beside manually entered servers in many versions.
  • Android uses DNS over TLS through Private DNS.
  • iPhone, iPad and macOS can use encrypted DNS through an operator's app or configuration profile.
  • Browsers have their own secure DNS option, usually in the privacy or security settings.
  • Routers support it only on some models and firmware.

Encryption protects the trip between your device and the resolver. The resolver itself still sees each name. The two protocols are compared in DNS over HTTPS and DNS over TLS.

Reverting cleanly

To undo a change, go back to the same screen and choose Automatic, then reconnect. On a router, restore the setting that takes DNS from the provider, which may be a checkbox or simply empty fields. Then flush caches, or restart the device, so that nothing keeps using the old resolver's answers.

If you cannot remember the original values, automatic is almost always what a home connection started with. Business networks with hand-entered settings are the exception, so ask whoever runs the network before overwriting anything there. Keeping a short note of what you changed, where and on what date saves a good deal of puzzling months later, when a new device behaves differently from the rest.

Check that it worked

On any computer:

nslookup example.com

The first lines name the server that answered. If it shows your router, check the router's upstream setting. Many resolver operators also publish a test page that says whether you are using their service.

Browsers can have their own secure DNS setting that overrides the system. Check it if the browser behaves differently from other programs.

If something breaks

  • Nothing resolves. Recheck for a typing error, then return to automatic.
  • Work or home devices by name stop resolving. Local names are only known to the local DNS server. Use it again, or set up split DNS properly.
  • A hotel or cafe sign-in page never appears. Switch to automatic, sign in, then switch back.
  • The setting reverts. A VPN client, security program or device management profile may be rewriting it.
  • Old results persist. Follow how to flush your DNS cache and restart the browser.

For further diagnosis, fixing "DNS server not responding" works through the usual causes.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in DNS & Domain Names →

Latest news on this topic