Netsh 接口 ip 设置 dns 注册

Netsh 接口 ip 设置 dns 注册

该命令的一个参数Netsh interface ip set dnsregister。它的用途是什么?我不明白帮助中给出的解释。如果我通过 Windows GUI 设置网络适配器的 DNS 配置,该参数将设置为哪个值?

命令帮助:

C:\Users\User>netsh int ipv4 set dns help

Usage: set dnsservers [name=]<string> [source=]dhcp|static
             [[address=]<IP address>|none]
             [[register=]none|primary|both]
             [[validate=]yes|no]

Parameters:

  Tag            Value
  name         - The name or index of the interface.
  source       - One of the following values:
                 dhcp: Sets DHCP as the source for configuring DNS
                       servers for the specific interface.
                 static: Sets the source for configuring DNS servers
                         to local static configuration.
  address      - One of the following values:
                 <IP address>: An IP address for a DNS server.
                 none: Clears the list of DNS servers.
  register     - One of the following values:
                 none: Disables Dynamic DNS registration.
                 primary: Register under the primary DNS suffix only.
                 both: Register under both the primary DNS suffix, as
                       well as under the connection-specific suffix.
  validate     - Specifies whether validation of the DNS server setting
                 will be performed. The value is yes by default.

Remarks: Sets DNS server configuration to either DHCP or static mode. Only
         when source is 'static', is the 'addr' option also available for
         configuring a static list of DNS server IP addresses for the
         specified interface. If Validate switch is yes, then
         the newly set DNS server is validated.

Examples:

   set dnsservers name="Wired Ethernet Connection" source=dhcp
   set dnsservers "Wired Ethernet Connection" static 10.0.0.1 primary

答案1

它调整指定接口的 IPV4 属性中的 DNS 值。

netsh interface ipv4 set dnsserver "Ethernet" static address=192.168.1.1 register=primary

在“控制面板\所有控制面板项\网络连接”中查看时设置此项: 在此处输入图片描述

https://superuser.com/a/204059/576067查看更多示例。

相关内容