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)
- Control Panel → Network and Sharing Center → Change adapter settings
- Right-click your adapter → Properties → Select "Internet Protocol Version 4 (TCP/IPv4)"
- 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
Command | Purpose |
---|---|
ping google.com | Checks if DNS resolves correctly. |
nslookup google.com | Manual DNS query tool. |
dig google.com | Advanced 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 stoppedipconfig /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
- Open browser and visit
192.168.1.1
or10.0.0.1
- 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
Aspect | Client | Router |
---|---|---|
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 |