salt.modules.win_network#

Module for gathering and managing network information

salt.modules.win_network.arp(expand=None)#

Return the arp table from the minion

expandNone

If True, return a list of neighbour entry dicts of the form {"ip": ..., "mac": ..., "dev": ..., "state": ...} instead of the legacy {mac: ip} mapping used by the Unix network module. The legacy mapping can only hold one entry per MAC address, so any further IP addresses sharing that MAC are silently dropped from it.

New in version 3008.5: The list-of-entries shape enabled by expand=True will become the default return shape in salt 3011; until then, calling this function without expand emits a DeprecationWarning, matching the deprecation cycle of the Unix network module.

CLI Example:

salt '*' network.arp
salt '*' network.arp expand=True
salt.modules.win_network.connect(host, port=None, **kwargs)#

Test connectivity to a host using a particular port from the minion.

New in version 2016.3.0.

Parameters:
  • host (str) -- The host to connect to

  • port (int, optional) --

    The port to connect to

    Default is None.

CLI Example:

salt '*' network.connect archlinux.org 80

salt '*' network.connect archlinux.org 80 timeout=3

salt '*' network.connect archlinux.org 80 timeout=3 family=ipv4

salt '*' network.connect google-public-dns-a.google.com port=53 proto=udp timeout=3
salt.modules.win_network.dig(host)#

Performs a DNS lookup with dig

Note: dig must be installed on the Windows minion

Parameters:

host (str) -- The host to lookup with dig

CLI Example:

salt '*' network.dig archlinux.org
salt.modules.win_network.get_route(ip)#

Return routing information for given destination ip

New in version 2016.11.5.

Parameters:

ip (str) -- The to find routing information for

CLI Example:

salt '*' network.get_route 10.10.10.10
salt.modules.win_network.hw_addr(iface)#

Return the hardware address (a.k.a. MAC address) for a given interface

Parameters:

iface (str) -- The interface name

CLI Example:

salt '*' network.hw_addr 'Wireless Connection #1'
salt.modules.win_network.hwaddr(iface)#

This function is an alias of hw_addr.

Return the hardware address (a.k.a. MAC address) for a given interface

Args:

iface (str): The interface name

CLI Example:

salt '*' network.hw_addr 'Wireless Connection #1'
salt.modules.win_network.in_subnet(cidr)#

Determine if a host is within a subnet

Parameters:

cidr (str) -- The CIDR to check

Returns:

True if host is within specified subnet, otherwise False

Return type:

bool

CLI Example:

salt '*' network.in_subnet 10.0.0.0/16
salt.modules.win_network.interfaces()#

Return a dictionary of information about all the interfaces on the minion

CLI Example:

salt '*' network.interfaces
salt.modules.win_network.interfaces_names()#

Return a list of all the interfaces names

CLI Example:

salt '*' network.interfaces_names
salt.modules.win_network.ip_addrs(interface=None, include_loopback=False, cidr=None, type=None)#

Returns a list of IPv4 addresses assigned to the host.

Parameters:
  • interface (str, optional) --

    Only IP addresses from that interface will be returned.

    Default is None.

  • include_loopback (bool, optional) --

    Include loopback 127.0.0.1 IPv4 address.

    Default is False.

  • cidr (str, optional) --

    Describes subnet using CIDR notation and only IPv4 addresses that belong

    to this subnet will be returned.

    Default is None.

    Changed in version 2019.2.0.

  • type (str, optional) --

    If option set to 'public' then only public addresses will be returned. Ditto for 'private'.

    Default is None.

    Changed in version 2019.2.0.

CLI Example:

salt '*' network.ip_addrs
salt '*' network.ip_addrs cidr=10.0.0.0/8
salt '*' network.ip_addrs cidr=192.168.0.0/16 type=private
salt.modules.win_network.ip_addrs6(interface=None, include_loopback=False, cidr=None)#

Returns a list of IPv6 addresses assigned to the host.

Parameters:
  • interface (str, optional) --

    Only IP addresses from that interface will be returned.

    Default is None.

  • include_loopback (bool, optional) --

    Include loopback ::1 IPv6 address.

    Default is False.

  • cidr (str, optional) --

    Describes subnet using CIDR notation and only IPv6 addresses that belong to this subnet will be returned.

    Default is None.

    Changed in version 2019.2.0.

CLI Example:

salt '*' network.ip_addrs6
salt '*' network.ip_addrs6 cidr=2000::/3
salt.modules.win_network.ip_neighs(expand=None)#

Return the ip neighbour (arp) table from the minion for IPv4 addresses

expandNone

If True, return a list of neighbour entry dicts of the form {"ip": ..., "mac": ..., "dev": ..., "state": ...} instead of the legacy {mac: ip} mapping used by the Unix network module. The legacy mapping can only hold one entry per MAC address, so any further IP addresses sharing that MAC are silently dropped from it.

New in version 3008.5: The list-of-entries shape enabled by expand=True will become the default return shape in salt 3011; until then, calling this function without expand emits a DeprecationWarning, matching the deprecation cycle of the Unix network module.

CLI Example:

salt '*' network.ip_neighs
salt '*' network.ip_neighs expand=True
salt.modules.win_network.ip_neighs6(expand=None)#

Return the ip neighbour (NDP) table from the minion for IPv6 addresses

expandNone

If True, return a list of neighbour entry dicts of the form {"ip": ..., "mac": ..., "dev": ..., "state": ...} instead of the legacy {mac: ip} mapping used by the Unix network module. The legacy mapping can only hold one entry per MAC address, and IPv6 hosts normally hold at least a link-local and a global address on the same MAC, so the legacy mapping loses entries for practically every neighbour; expand=True is strongly recommended.

New in version 3008.5: The list-of-entries shape enabled by expand=True will become the default return shape in salt 3011; until then, calling this function without expand emits a DeprecationWarning, matching the deprecation cycle of the Unix network module.

CLI Example:

salt '*' network.ip_neighs6
salt '*' network.ip_neighs6 expand=True
salt.modules.win_network.ipaddrs(interface=None, include_loopback=False, cidr=None, type=None)#

This function is an alias of ip_addrs.

Returns a list of IPv4 addresses assigned to the host.

Args:

interface (str, optional):

Only IP addresses from that interface will be returned.

Default is None.

include_loopback (bool, optional):

Include loopback 127.0.0.1 IPv4 address.

Default is False.

cidr (str, optional):

Describes subnet using CIDR notation and only IPv4 addresses that belong to this subnet will be returned.

Default is None.

Changed in version 2019.2.0.

type (str, optional):

If option set to 'public' then only public addresses will be returned. Ditto for 'private'.

Default is None.

Changed in version 2019.2.0.

CLI Example:

salt '*' network.ip_addrs
salt '*' network.ip_addrs cidr=10.0.0.0/8
salt '*' network.ip_addrs cidr=192.168.0.0/16 type=private
salt.modules.win_network.ipaddrs6(interface=None, include_loopback=False, cidr=None)#

This function is an alias of ip_addrs6.

Returns a list of IPv6 addresses assigned to the host.

Args:

interface (str, optional):

Only IP addresses from that interface will be returned.

Default is None.

include_loopback (bool, optional):

Include loopback ::1 IPv6 address.

Default is False.

cidr (str, optional):

Describes subnet using CIDR notation and only IPv6 addresses that belong to this subnet will be returned.

Default is None.

Changed in version 2019.2.0.

CLI Example:

salt '*' network.ip_addrs6
salt '*' network.ip_addrs6 cidr=2000::/3
salt.modules.win_network.ipneighs(expand=None)#

This function is an alias of ip_neighs.

Return the ip neighbour (arp) table from the minion for IPv4 addresses

expandNone

If True, return a list of neighbour entry dicts of the form {"ip": ..., "mac": ..., "dev": ..., "state": ...} instead of the legacy {mac: ip} mapping used by the Unix network module. The legacy mapping can only hold one entry per MAC address, so any further IP addresses sharing that MAC are silently dropped from it.

New in version 3008.5: The list-of-entries shape enabled by expand=True will become the default return shape in salt 3011; until then, calling this function without expand emits a DeprecationWarning, matching the deprecation cycle of the Unix network module.

CLI Example:

salt '*' network.ip_neighs
salt '*' network.ip_neighs expand=True
salt.modules.win_network.ipneighs6(expand=None)#

This function is an alias of ip_neighs6.

Return the ip neighbour (NDP) table from the minion for IPv6 addresses

expandNone

If True, return a list of neighbour entry dicts of the form {"ip": ..., "mac": ..., "dev": ..., "state": ...} instead of the legacy {mac: ip} mapping used by the Unix network module. The legacy mapping can only hold one entry per MAC address, and IPv6 hosts normally hold at least a link-local and a global address on the same MAC, so the legacy mapping loses entries for practically every neighbour; expand=True is strongly recommended.

New in version 3008.5: The list-of-entries shape enabled by expand=True will become the default return shape in salt 3011; until then, calling this function without expand emits a DeprecationWarning, matching the deprecation cycle of the Unix network module.

CLI Example:

salt '*' network.ip_neighs6
salt '*' network.ip_neighs6 expand=True
salt.modules.win_network.is_private(ip_addr)#

Check if the given IP address is a private address

New in version 2019.2.0.

Parameters:

ip_addr (str) -- The IP address to check

CLI Example:

salt '*' network.is_private 10.0.0.3
salt.modules.win_network.netstat()#

Return information on open ports and states

CLI Example:

salt '*' network.netstat
salt.modules.win_network.nslookup(host)#

Query DNS for information about a domain or ip address

Parameters:

host (str) -- The domain or ip address to lookup

CLI Example:

salt '*' network.nslookup archlinux.org
salt.modules.win_network.ping(host, timeout=False, return_boolean=False)#

Performs a ping to a host

Parameters:
  • host (str) -- The host to ping

  • timeout (bool, optional) -- Timeout in seconds. Defaults is False.

  • return_boolean (bool, optional) -- Return boolean.

CLI Example:

salt '*' network.ping archlinux.org

New in version 2016.11.0.

Return a True or False instead of ping output.

salt '*' network.ping archlinux.org return_boolean=True

Set the time to wait for a response in seconds.

salt '*' network.ping archlinux.org timeout=3
salt.modules.win_network.subnets()#

Returns a list of subnets to which the host belongs

CLI Example:

salt '*' network.subnets
salt.modules.win_network.traceroute(host)#

Performs a traceroute to a 3rd party host

Parameters:

host (str) -- The host to target with traceroute

CLI Example:

salt '*' network.traceroute archlinux.org