ipaddress.IPv6Network

class ipaddress.IPv6Network(address, strict=True)

Construct an IPv6 network definition. address can be one of the following:

  1. A string consisting of an IP address and an optional mask, separated by a slash (/). The IP address is the network address, and the mask can be either a single number, which means it’s a prefix, or a string representation of an IPv6 address. If it’s the latter, the mask is interpreted as a net mask. If no mask is provided, it’s considered to be /128.

    For example, the following address specifications are equivalent: 2001:db00::0/24 and 2001:db00::0/ffff:ff00::.

  2. An integer that fits into 128 bits. This is equivalent to a single-address network, with the network address being address and the mask being /128.
  3. An integer packed into a bytes object of length 16, big-endian. The interpretation is similar to an integer address.
  4. A two-tuple of an address description and a netmask, where the address description is either a string, a 128-bits integer, a 16-bytes packed integer, or an existing IPv6Address object; and the netmask is an integer representing the prefix length.

An AddressValueError is raised if address is not a valid IPv6 address. A NetmaskValueError is raised if the mask is not valid for an IPv6 address.

If strict is True and host bits are set in the supplied address, then ValueError is raised. Otherwise, the host bits are masked out to determine the appropriate network address.

Changed in version 3.5: Added the two-tuple form for the address constructor parameter.

version
max_prefixlen
is_multicast
is_private
is_unspecified
is_reserved
is_loopback
is_link_local
network_address
broadcast_address
hostmask
with_prefixlen
compressed
exploded
with_netmask
with_hostmask
num_addresses
prefixlen
hosts()
overlaps(other)
address_exclude(network)
subnets(prefixlen_diff=1, new_prefix=None)
supernet(prefixlen_diff=1, new_prefix=None)
compare_networks(other)

Refer to the corresponding attribute documentation in IPv4Network

is_site_local

These attribute is true for the network as a whole if it is true for both the network address and the broadcast address

doc_python
2016-10-07 17:35:39
Comments
Leave a Comment

Please login to continue.