DNS Configuration on Clients and Routers - Complete Guide

1. DNS Configuration on a Client

A. Manual DNS vs. Automatic (DHCP-assigned)

  • Automatic (DHCP): DNS is assigned by the router or ISP.
  • Manual: DNS is specified manually, e.g., Google DNS (8.8.8.8).

B. Setting Preferred & Alternate DNS Servers

Windows (GUI)

  1. Control Panel → Network and Sharing Center → Change adapter settings
  2. Right-click your adapter → Properties → Select "Internet Protocol Version 4 (TCP/IPv4)"
  3. Choose "Use the following DNS server addresses":
    • Preferred DNS: 8.8.8.8 (Google)
    • Alternate DNS: 1.1.1.1 (Cloudflare)

Windows (Command Line)

netsh interface ip set dns "Ethernet" static 8.8.8.8
netsh interface ip add dns "Ethernet" 1.1.1.1 index=2
  

Linux (nmcli)

nmcli con mod eth0 ipv4.dns "8.8.8.8 1.1.1.1"
nmcli con up eth0
  

Linux (resolv.conf)

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
  

C. Testing DNS Configuration

CommandPurpose
ping google.comChecks if DNS resolves correctly.
nslookup google.comManual DNS query tool.
dig google.comAdvanced DNS lookup (Linux).

D. Flushing DNS Cache

Windows:

ipconfig /flushdns

Linux (systemd):

sudo systemd-resolve --flush-caches

E. Editing hosts File

  • Windows: C:\Windows\System32\drivers\etc\hosts
  • Linux: /etc/hosts
192.168.1.100  myserver.local

F. Troubleshooting DNS

  • sc query dnscache – Check if DNS Client service is running (Windows)
  • net start dnscache – Start the service if it's stopped
  • ipconfig /all – View current DNS configuration
  • Try alternate DNS servers (e.g., 1.1.1.1)

2. DNS Configuration on a Router

A. Accessing the Router

  1. Open browser and visit 192.168.1.1 or 10.0.0.1
  2. Log in with admin credentials

B. Configuring Static DNS

  • Navigate to DNS or WAN settings
  • Set DNS as:
    • Primary: 8.8.8.8 (Google)
    • Secondary: 1.1.1.1 (Cloudflare)

C. Forwarding DNS Requests

  • Default: Use ISP DNS
  • Advanced: Forward DNS to local DNS server (e.g., AD/DNS)

D. DNS Relay and Proxy

  • Relay: Router forwards DNS to external resolvers
  • Proxy: Router caches queries for faster responses

E. DHCP and DNS Integration

Router pushes DNS to clients via DHCP:

DHCP Option 6 = 8.8.8.8, 1.1.1.1

F. Using Router as a Local DNS Resolver

For LAN hostnames resolution:

uci set dhcp.@dnsmasq[0].local="/lan/"
uci commit
  

G. Custom DNS per VLAN/Subnet (Cisco)

ip dhcp pool VLAN10
  dns-server 192.168.10.100
  

H. DNS over HTTPS (DoH) / DNS over TLS (DoT)

  • Encrypt DNS queries
  • Protect against ISP-level DNS snooping
  • Example for DoT:
DNS Privacy Protocol: DNS-over-TLS
Upstream DNS: tls://1.1.1.1
  

I. Testing DNS from Router or Client

From client:

nslookup example.com

From router (if CLI is available):

ping google.com

3. Example: Home Network DNS Setup

  • Router: ASUS @ 192.168.1.1
  • Clients receive DNS via DHCP
  • DNS Settings:
    • Primary: 8.8.8.8
    • Secondary: 1.1.1.1
    • Enable DNS-over-TLS for privacy
  • Client Test:
  • ipconfig /all | find "DNS Servers"

4. Summary

AspectClientRouter
Configuration GUI or Command Line Web Interface or CLI
DNS Testing nslookup, dig, ping nslookup, ping
Advanced Features hosts file, DNS cache flush DoH, DoT, DHCP integration
Privacy Can use secure DNS resolvers Supports encrypted DNS relay

DNS Configuration on Clients and Routers - Quiz

1. What is the default way clients usually get DNS settings?

Correct answer is B. Clients typically receive DNS addresses automatically via DHCP.

2. Which command sets a static DNS server on Windows via command line?

Correct answer is D. The netsh command sets a static DNS server on Windows.

3. How do you flush DNS cache on Windows?

Correct answer is C. ipconfig /flushdns clears the DNS resolver cache on Windows.

4. Where is the hosts file located on Linux systems?

Correct answer is A. The hosts file on Linux is located at /etc/hosts.

5. What is the primary way to configure DNS servers on a router?

Correct answer is B. Routers set DNS servers via LAN or DHCP DNS settings for clients.

6. What does DNS Relay on a router do?

Correct answer is C. DNS Relay forwards DNS queries to upstream servers.

7. Which two public DNS servers are mentioned as examples?

Correct answer is D. Google DNS (8.8.8.8) and Cloudflare DNS (1.1.1.1) are common public DNS servers.

8. How can DNS-over-TLS or DNS-over-HTTPS benefit DNS configuration?

Correct answer is A. DNS-over-TLS and DNS-over-HTTPS encrypt DNS traffic, improving privacy.

9. What command can you use on a client to verify DNS resolution?

Correct answer is B. nslookup tests DNS resolution for a domain.

10. Where can you configure DNS settings on Windows via GUI?

Correct answer is C. You configure DNS in the IPv4 properties via Network and Sharing Center.

← Back to Home