# salt.states.win_network

## Configuration of network interfaces on Windows hosts

New in version Hydrogen.

This module provides the `network` state(s) on Windows hosts. DNS servers, IP addresses and default gateways can currently be managed.

Below is an example of the configuration for an interface that uses DHCP for both DNS servers and IP addresses:

    Local Area Connection #2:
      network.managed:
        - dns_proto: dhcp
        - ip_proto: dhcp

Note

Both the `dns_proto` and `ip_proto` arguments are required.

Static DNS and IP addresses can be configured like so:

    Local Area Connection #2:
      network.managed:
        - dns_proto: static
        - dns_servers:
          - 8.8.8.8
          - 8.8.4.4
        - ip_proto: static
        - ip_addrs:
          - 10.2.3.4/24

Note

IP addresses are specified using the format `<ip-address>/<subnet-length>`. Salt provides a convenience function called `ip.get_subnet_length` to calculate the subnet length from a netmask.

Optionally, if you are setting a static IP address, you can also specify the default gateway using the `gateway` parameter:

    Local Area Connection #2:
      network.managed:
        - dns_proto: static
        - dns_servers:
          - 8.8.8.8
          - 8.8.4.4
        - ip_proto: static
        - ip_addrs:
          - 10.2.3.4/24
        - gateway: 10.2.3.1

`salt.states.win_network.` `managed`(name, dns_proto=None, dns_servers=None, ip_proto=None, ip_addrs=None, gateway=None, enabled=True, **kwargs)

  Ensure that the named interface is configured properly.

  name
    The name of the interface to manage
  dns_proto : None
    Set to `static` and use the `dns_servers` parameter to provide a list of DNS nameservers. set to `dhcp` to use DHCP to get the DNS servers.
  dns_servers : None
    A list of static DNS servers.
  ip_proto : None
    Set to `static` and use the `ip_addrs` and (optionally) `gateway` parameters to provide a list of static IP addresses and the default gateway. Set to `dhcp` to use DHCP.
  ip_addrs : None
    A list of static IP addresses.
  gateway : None
    A list of static IP addresses.
  enabled : True
    Set to `False` to ensure that this interface is disabled.

Current Salt release: 0.17.1

### Table Of Contents

- salt.states.win_network
  - Configuration of network interfaces on Windows hosts

#### Previous topic

salt.states.win_firewall

#### Next topic

salt.states.win_path

### Quick search

Enter search terms or a module, class or function name.

### Upcoming SaltStack Events

My conferences on Lanyrd