大网数据广告活动
Windows排障命令

netsh dnsclient

· 52CE 我爱测

The netsh dnsclient command configures and manages DNS client settings in Windows.

The netsh dnsclient command is used to configure and manage Domain Name System (DNS) client settings on a Windows computer. It allows administrators to add, delete, set, and display DNS server addresses, encryption settings, and global DNS client options. This command is useful for automating DNS configuration, troubleshooting name resolution issues, and managing advanced DNS features such as DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT).

Syntax

netsh dnsclient [add | delete | dump | help | set | show | ?]
netsh dnsclient add dnsserver [name=]<string> [address=]<IP address> [[index=]<integer>] [[validate=]yes|no]
netsh dnsclient add encryption [server=]<IP address> [dohtemplate=]<string> [dothost=]<hostname>:<port> [[autoupgrade=]yes|no] [[udpfallback=]yes|no]
netsh dnsclient add global [[doh=]yes|no|auto] [[dot=]yes|no] [[ddr=]yes|no]
netsh dnsclient add interface [name=]<string> [[ddr=]yes|no] [[ddrfallback=]yes|no]
netsh dnsclient delete dnsserver [name=]<string> [address=]<IP address> [[index=]<integer>] [[validate=]yes|no]
netsh dnsclient delete encryption [server=]<IP address> [[protocol=]doh|dot]
netsh dnsclient delete global [global=](doh|dot|ddr|all)
netsh dnsclient delete interface [name=]<string> [setting=](ddr|all)
netsh dnsclient <dump>
netsh dnsclient set dnsserver [name=]<string> [source=]dhcp|static [[address=]<IP address>|none] [[register=]none|primary|both] [[validate=]yes|no]
netsh dnsclient set encryption [server=]<IP address> [dohtemplate=]<string> [dothost=]<hostname>:<port> [[autoupgrade=]yes|no] [[udpfallback=]yes|no]
netsh dnsclient set global [[doh=]yes|no|auto] [[dot=]yes|no] [[ddr=]yes|no]
netsh dnsclient set interface [name=]<string> [[ddr=]yes|no] [[ddrfallback=]yes|no]
netsh dnsclient show encryption [[server=]<IP address>]
netsh dnsclient show [global | state]

Parameters

Parameter Description
add dnsserver name=<string> address=<IP address> index=<integer> `validate=<yes no>`
add encryption server=<IP address> dohtemplate=<string> dothost=<hostname>:<port> `autoupgrade=<yes no> udpfallback=<yes
add global `doh=<yes no
add interface name=<string> `ddr=<yes no> ddrfallback=<yes
delete dnsserver name=<string> address=<IP address> index=<integer> `validate=<yes no>`
delete encryption server=<IP address> `protocol=<doh dot>`
delete global `global=<doh dot
delete interface name=<string> `setting=<ddr all>`
dump Outputs a configuration script containing the current DNS client settings.
set dnsserver name=<string> `source=<dhcp static> address=<IP address>
set encryption server=<IP address> dohtemplate=<string> dothost=<hostname>:<port> `autoupgrade=<yes no> udpfallback=<yes
set global `doh=<yes no
set interface name=<string> `ddr=<yes no> ddrfallback=<yes
show encryption server=<IP address> Displays the encrypted DNS server settings from the list of statically configured secure resolvers. If no server is specified, information for all encrypted DNS servers is shown. server - Specifies the encrypted DNS server by IP address.
show <global> Displays all configured DNS global settings.
show <state> Displays the current configuration and status of the DNS client.
help or ? Provides help for the list of commands available in the netsh dnsclient context.

Examples

To add a DNS configuration or setting (for example, a specific DNS server address), run the following command:

netsh dnsclient add dnsserver Ethernet=192.168.10.1

To delete a DNS configuration or setting (such as a specific DNS server address), run the following command:

netsh dnsclient delete dnsserver Ethernet=192.168.10.1

To set a static DNS server address for a specific network interface, run the following command:

netsh dnsclient set dnsserver name=Ethernet source=static address=192.168.10.1 register=primary validate=yes

To show globally configured DNS settings, run the following command:

netsh dnsclient show global

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 07/28/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。