brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Set-DnsClientServerAddress changes the DNS server of one Windows adapter

Network and access
~/tips/tip-dns-set-dnsclientserveraddress-windows

Get-DnsClientServerAddress -AddressFamily IPv4

Point a Windows network adapter at your own DNS server from PowerShell and undo it later.

Changing DNS servers in the Windows settings means clicking through several screens per adapter. In an elevated PowerShell window it is one line, and it is easy to undo.

First see your adapters and what they use now:

Get-DnsClientServerAddress -AddressFamily IPv4

Then set one or more servers on an adapter by its name:

Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses ("192.0.2.53","192.0.2.54")

Microsoft’s docs say these addresses are static and override what DHCP hands out for that interface. That is the point when you want a test machine on your own Pi-hole or AdGuard Home, but also the reason to undo it on a laptop that travels. -Validate checks that the servers answer before it sets them.

Back to whatever DHCP gives:

Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses

Adapter names differ per machine, so use the names from the first command. Wi-Fi is often just Wi-Fi.

IPv6 has its own DNS servers. If the adapter also gets an IPv6 DNS server from the router, Windows may ask that one too and your filter misses part of the traffic. I’d check the IPv6 list with -AddressFamily IPv6 as well.

Further reading: Set-DnsClientServerAddress, Get-DnsClientServerAddress

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link