salt.modules.win_dns_client

Module for configuring DNS Client on Windows systems

salt.modules.win_dns_client.add_dns(ip, interface='Local Area Connection', index=1)

Add the DNS server to the network interface (index starts from 1)

Note: if the interface DNS is configured by DHCP, all the DNS servers will be removed from the interface and the requested DNS will be the only one

Parameters:
  • ip (str) -- The IP address of the DNS server to remove.

  • interface (str, optional) -- The name of the network interface. This is the name as it appears in the Control Panel under Network Connections. Default is Local Area Connection.

  • index (int, optional) -- The index to add the DNS server to. Default is 1.

CLI Example:

salt '*' win_dns_client.add_dns <ip> <interface> <index>
salt.modules.win_dns_client.dns_dhcp(interface='Local Area Connection')

Configure the interface to get its DNS servers from the DHCP server

Parameters:

interface (str, optional) -- The name of the network interface. This is the name as it appears in the Control Panel under Network Connections. Default is Local Area Connection.

CLI Example:

salt '*' win_dns_client.dns_dhcp <interface>
salt.modules.win_dns_client.get_dns_config(interface='Local Area Connection')

Get the type of DNS configuration (dhcp / static).

Parameters:

interface (str, optional) -- The name of the network interface. This is the name as it appears in the Control Panel under Network Connections. Default is Local Area Connection.

Returns:

True if DNS is configured, otherwise False

Return type:

bool

CLI Example:

salt '*' win_dns_client.get_dns_config 'Local Area Connection'
salt.modules.win_dns_client.get_dns_servers(interface='Local Area Connection')

Return a list of the configured DNS servers of the specified interface

Parameters:

interface (str, optional) -- The name of the network interface. This is the name as it appears in the Control Panel under Network Connections. Default is Local Area Connection.

Returns:

A list of dns servers

Return type:

list

CLI Example:

salt '*' win_dns_client.get_dns_servers 'Local Area Connection'
salt.modules.win_dns_client.rm_dns(ip, interface='Local Area Connection')

Remove the DNS server from the network interface

Parameters:
  • ip (str) -- The IP address of the DNS server to remove.

  • interface (str, optional) -- The name of the network interface. This is the name as it appears in the Control Panel under Network Connections. Default is Local Area Connection.

CLI Example:

salt '*' win_dns_client.rm_dns <ip> <interface>