Here the class hierarchy for IP related classes
+--------+ +-------------+
| BaseIP | | IPListMixin |
+---------+ +--------+ +-------------+ +---------+
| ipv4(M) | | | | | ipv6(M) |
+---------+ | | | +---------+
| +----------------+----------------+ | |
(HAS A) | | | | | (HAS A)
| | | | | | |
+-----+----------------+-----------------+ | | |
| | +--------|-------+---------|--------+--------+
| | | | | | | | | | |
| | | | | | | | | | |
v v v v v v | | | | |
+-----------+ +-----------+ | | | | |
| IPAddress | | IPNetwork |<---+ | | | |
+-----------+ +-----------+ | | | |
| | | | | |
(HAS A) (HAS A) | | | |
| | v v v v
+-------+--------+ +------------+
| | IPRange |
| +------------+
v |
+-------+ |
| IPSet | v
+-------+ +--------+
| IPGlob |
+--------+
The following constants are used by the various flags arguments on netaddr class constructors.
An Exception indicating a failure to convert between address types or notations.
An Exception indicating a network address is not correctly formatted.
An Exception indicating that an OUI or IAB was not found in the IEEE Registry.
An IP address is a virtual address used to identify the source and destination of (layer 3) packets being transferred between hosts in a switched network. This library fully supports both IPv4 and the new IPv6 standards.
The IPAddress class is used to identify individual IP addresses.
An individual IPv4 or IPv6 address without a net mask or subnet prefix.
To support these and other network based operations, see IPNetwork.
Add the numerical value of this IP address to num and provide the result as a new IPAddress object.
Parameters: | num – size of IP address increase. |
---|---|
Returns: | a new IPAddress object with its numerical value increased by num. |
Parameters: | other – An IPAddress object (or other int-like object). |
---|---|
Returns: | bitwise AND (x & y) between the integer value of this IP address and other. |
Returns: | True if the numerical value of this IP address is not zero, False otherwise. |
---|
Returns: | Pickled state of an IPAddress object. |
---|
Returns: | a hexadecimal string representation of this IP address. |
---|
Increases the numerical value of this IPAddress by num.
An IndexError is raised if result exceeds maximum IP address value or is less than zero.
Parameters: | num – size of IP address increment. |
---|
Returns: | return the integer value of this IP address when called by hex(), oct() or bin(). |
---|
Constructor.
Parameters: |
|
---|
Returns: | the value of this IP address as an unsigned integer |
---|
Decreases the numerical value of this IPAddress by num.
An IndexError is raised if result is less than zero or exceeds maximum IP address value.
Parameters: | num – size of IP address decrement. |
---|
Returns: | the value of this IP address as an unsigned integer |
---|
Parameters: | numbits – size of bitwise shift. |
---|---|
Returns: | an IPAddress object based on this one with its integer value left shifted by numbits. |
Returns: | True if the numerical value of this IP address is not zero, False otherwise. |
---|
Returns: | an octal string representation of this IP address. |
---|
Parameters: | other – An IPAddress object (or other int-like object). |
---|---|
Returns: | bitwise OR (x | y) between the integer value of this IP address and other. |
Add the numerical value of this IP address to num and provide the result as a new IPAddress object.
Parameters: | num – size of IP address increase. |
---|---|
Returns: | a new IPAddress object with its numerical value increased by num. |
Returns: | Python statement to create an equivalent object |
---|
Parameters: | numbits – size of bitwise shift. |
---|---|
Returns: | an IPAddress object based on this one with its integer value right shifted by numbits. |
Subtract num (lvalue) from the numerical value of this IP address (rvalue) providing the result as a new IPAddress object.
Parameters: | num – size of IP address decrease. |
---|---|
Returns: | a new IPAddress object with its numerical value decreased by num. |
Parameters: | state – data used to unpickle a pickled IPAddress object. |
---|
Returns: | IP address in presentational format |
---|
Subtract the numerical value of this IP address from num providing the result as a new IPAddress object.
Parameters: | num – size of IP address decrease. |
---|---|
Returns: | a new IPAddress object with its numerical value decreased by num. |
Parameters: | other – An IPAddress object (or other int-like object). |
---|---|
Returns: | bitwise exclusive OR (x ^ y) between the integer value of this IP address and other. |
The value of this IP adddress in standard Python binary representational form (0bxxx). A back port of the format provided by the builtin bin() function found in Python 2.6.x and higher.
Parameters: | word_sep – (optional) the separator to insert between words. Default: None - use default separator for address type. |
---|---|
Returns: | the value of this IP address as a binary digit string. |
Only relevant for IPv6 addresses. Has no effect for IPv4.
Parameters: | dialect – An ipv6_* dialect class. |
---|---|
Returns: | an alternate string representation for this IP address. |
Raises an AddrConversionError if IPv6 address cannot be converted to IPv4.
Returns: | A numerically equivalent version 4 IPAddress object. |
---|
Note
The IPv4-mapped IPv6 address format is now considered deprecated. See RFC 4291 or later for details.
Parameters: | ipv4_compatible – If True returns an IPv4-mapped address (::ffff:x.x.x.x), an IPv4-compatible (::x.x.x.x) address otherwise. Default: False (IPv4-mapped). |
---|---|
Returns: | A numerically equivalent version 6 IPAddress object. |
Returns: | True if this IP address host mask, False otherwise. |
---|
Returns: | True if this IP address network mask, False otherwise. |
---|
Returns: | a key tuple that uniquely identifies this IP address. |
---|
The value of this IP address as a packed binary string.
The reverse DNS lookup record for this IP address
Returns: | A key tuple used to compare and sort this IPAddress correctly. |
---|
A list of unsigned integer words (octets for IPv4, hextets for IPv6) found in this IP address.
The following dialect classes can be used with the IPAddress.format method.
An IPv6 dialect class - compact form.
Boolean flag indicating if IPv6 compaction algorithm should be used.
The format string used to converting words into string values.
The IPNetwork class is used to represent a group of IP addresses that comprise a network/subnet/VLAN containing hosts.
Nowadays, IP networks are usually specified using the CIDR format with a prefix indicating the size of the netmask. In the real world, there are a number of ways to express a “network”” and so the flexibility of the IPNetwork class constructor reflects this.
An IPv4 or IPv6 network or subnet.
A combination of an IP address and a network mask.
Accepts CIDR and several related variants :
Standard CIDR:
x.x.x.x/y -> 192.0.2.0/24
x::/y -> fe80::/10
Hybrid CIDR format (netmask address instead of prefix), where ‘y’ address represent a valid netmask:
x.x.x.x/y.y.y.y -> 192.0.2.0/255.255.255.0
x::/y:: -> fe80::/ffc0::
ACL hybrid CIDR format (hostmask address instead of prefix like Cisco’s ACL bitmasks), where ‘y’ address represent a valid netmask:
x.x.x.x/y.y.y.y -> 192.0.2.0/0.0.0.255
x::/y:: -> fe80::/3f:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Abbreviated CIDR format (as of netaddr 0.7.x this requires the optional constructor argument implicit_prefix=True):
x -> 192
x/y -> 10/8
x.x/y -> 192.168/16
x.x.x/y -> 192.168.0/24
which are equivalent to::
x.0.0.0/y -> 192.0.0.0/24
x.0.0.0/y -> 10.0.0.0/8
x.x.0.0/y -> 192.168.0.0/16
x.x.x.0/y -> 192.168.0.0/24
Parameters: | other – an IPAddress or ranged IP object. |
---|---|
Returns: | True if other falls within the boundary of this one, False otherwise. |
Returns: | Pickled state of an IPNetwork object. |
---|
Increases the value of this IPNetwork object by the current size multiplied by num.
An IndexError is raised if result exceeds maximum IP address value or is less than zero.
Parameters: | num – (optional) number of IPNetwork blocks to increment this IPNetwork’s value by. |
---|
Constructor.
Parameters: |
|
---|
Decreases the value of this IPNetwork object by the current size multiplied by num.
An IndexError is raised if result is less than zero or exceeds maximum IP address value.
Parameters: | num – (optional) number of IPNetwork blocks to decrement this IPNetwork’s value by. |
---|
Returns: | Python statement to create an equivalent object |
---|
Parameters: | state – data used to unpickle a pickled IPNetwork object. |
---|
Returns: | this IPNetwork in CIDR format |
---|
list of weak references to the object (if defined)
The broadcast address of this IPNetwork object
The true CIDR address for this IPNetwork object which omits any host bits to the right of the CIDR subnet prefix.
The integer value of first IP address found within this IPNetwork object.
The host mask of this IPNetwork object.
The IP address of this IPNetwork object. This is may or may not be the same as the network IP address which varies according to the value of the CIDR subnet prefix.
Returns: | A numerically equivalent version 4 IPNetwork object. Raises an AddrConversionError if IPv6 address cannot be converted to IPv4. |
---|
Note
the IPv4-mapped IPv6 address format is now considered deprecated. See RFC 4291 or later for details.
Parameters: | ipv4_compatible – If True returns an IPv4-mapped address (::ffff:x.x.x.x), an IPv4-compatible (::x.x.x.x) address otherwise. Default: False (IPv4-mapped). |
---|---|
Returns: | A numerically equivalent version 6 IPNetwork object. |
An generator that provides all the IP addresses that can be assigned to hosts within the range of this IP object’s subnet.
Returns: | an IPAddress iterator |
---|
Returns: | A key tuple used to uniquely identify this IPNetwork. |
---|
The integer value of last IP address found within this IPNetwork object.
The subnet mask of this IPNetwork object.
The network address of this IPNetwork object.
Parameters: | step – the number of IP subnets between this IPNetwork object and the expected subnet. Default: 1 (the next IP subnet). |
---|---|
Returns: | The adjacent subnet succeeding this IPNetwork object. |
size of the bitmask used to separate the network from the host bits
Parameters: | step – the number of IP subnets between this IPNetwork object and the expected subnet. Default: 1 (the previous IP subnet). |
---|---|
Returns: | The adjacent subnet preceding this IPNetwork object. |
Returns: | A key tuple used to compare and sort this IPNetwork correctly. |
---|
A generator that divides up this IPNetwork’s subnet into smaller subnets based on a specified CIDR prefix.
Parameters: |
|
---|---|
Returns: | an iterator containing IPNetwork subnet objects. |
Provides a list of supernets for this IPNetwork object between the size of the current prefix and (if specified) an endpoint prefix.
Parameters: | prefixlen – (optional) a CIDR prefix for the maximum supernet. Default: 0 - returns all possible supernets. |
---|---|
Returns: | a tuple of supernet IPNetwork objects. |
netaddr was designed to accomodate the many different ways in which groups of IP addresses and IP networks are specified, not only in router configurations but also less standard but more human-readable forms found in, for instance, configuration files.
Here are the options currently available.
A bounded range is a group of IP addresses specified using a start and end address forming a contiguous block. No bit boundaries are assumed but the end address must be numerically greater than or equal to the start address.
An arbitrary IPv4 or IPv6 address range.
Formed from a lower and upper bound IP address. The upper bound IP cannot be numerically smaller than the lower bound and the IP version of both must match.
Returns: | Pickled state of an IPRange object. |
---|
Constructor.
Parameters: |
|
---|
Returns: | Python statement to create an equivalent object |
---|
Parameters: | state – data used to unpickle a pickled IPRange object. |
---|
Returns: | this IPRange in a common representational format. |
---|
list of weak references to the object (if defined)
The list of CIDR addresses found within the lower and upper bound addresses of this IPRange.
The integer value of first IP address in this IPRange object.
Returns: | A key tuple used to uniquely identify this IPRange. |
---|
The integer value of last IP address in this IPRange object.
Returns: | A key tuple used to compare and sort this IPRange correctly. |
---|
A very useful way to represent IP network in configuration files and on the command line for those who do not speak CIDR.
The IPGlob class is used to represent individual glob ranges.
Represents an IP address range using a glob-style syntax x.x.x-y.*
Individual octets can be represented using the following shortcuts :
- * - the asterisk octet (represents values 0 through 255)
- x-y - the hyphenated octet (represents values x through y)
A few basic rules also apply :
- x must always be greater than y, therefore :
- x can only be 0 through 254
- y can only be 1 through 255
- only one hyphenated octet per IP glob is allowed
- only asterisks are permitted after a hyphenated octet
Examples:
IP glob | Description |
---|---|
192.0.2.1 | a single address |
192.0.2.0-31 | 32 addresses |
192.0.2.* | 256 addresses |
192.0.2-3.* | 512 addresses |
192.0-1.*.* | 131,072 addresses |
*.*.*.* | the whole IPv4 address space |
Note
IP glob ranges are not directly equivalent to CIDR blocks. They can represent address ranges that do not fall on strict bit mask boundaries. They are suitable for use in configuration files, being more obvious and readable than their CIDR counterparts, especially for admins and end users with little or no networking knowledge or experience. All CIDR addresses can always be represented as IP globs but the reverse is not always true.
Returns: | Pickled state of an IPGlob object. |
---|
Returns: | Python statement to create an equivalent object |
---|
Parameters: | state – data used to unpickle a pickled IPGlob object. |
---|
Returns: | IP glob in common representational format. |
---|
an arbitrary IP address range in glob format.
It is also very useful to be able to convert between glob ranges and CIDR and IP ranges. The following function enable these various conversions.
A function that accepts an IP subnet in a glob-style format and returns a list of CIDR subnets that exactly matches the specified glob.
Parameters: | cidr – an IP object CIDR subnet. |
---|---|
Returns: | a list of one or more IP addresses and subnets. |
A function that accepts a glob-style IP range and returns a list of one or more IP CIDRs that exactly matches it.
Parameters: | ipglob – an IP address range in a glob-style format. |
---|---|
Returns: | a list of one or more IP objects. |
A function that accepts a glob-style IP range and returns the equivalent IP range.
Parameters: | ipglob – an IP address range in a glob-style format. |
---|---|
Returns: | an IPRange object. |
A function that accepts a glob-style IP range and returns the component lower and upper bound IP address.
Parameters: | ipglob – an IP address range in a glob-style format. |
---|---|
Returns: | a tuple contain lower and upper bound IP objects. |
A function that accepts an arbitrary start and end IP address or subnet and returns one or more glob-style IP ranges.
Parameters: |
|
---|---|
Returns: | a list containing one or more IP globs. |
nmap is a well known network security tool. It has a particularly flexible way of specifying IP address groupings.
Functions are provided that allow the verification and enumeration of IP address specified in this format.
Parameters: | nmap_target_spec – an nmap-style IP range target specification. |
---|---|
Returns: | True if IP range target spec is valid, False otherwise. |
The nmap security tool supports a custom type of IPv4 range using multiple hyphenated octets. This generator provides iterators yielding IP addresses according to this rule set.
Parameters: | nmap_target_spec – an nmap-style IP range target specification. |
---|---|
Returns: | an iterator producing IPAddress objects for each IP in the range. |
When dealing with large numbers of IP addresses and ranges it is often useful to manipulate them as sets so you can calculate intersections, unions and differences between various groups of them.
The IPSet class was built specifically for this purpose.
Represents an unordered collection (set) of unique IP addresses and subnets.
Parameters: | other – an IP set. |
---|---|
Returns: | the intersection of this IP set and another as a new IP set. (IP addresses and subnets common to both sets). |
Return True if IPSet contains at least one IP, else False
Parameters: | ip – An IP address or subnet. |
---|---|
Returns: | True if IP address or subnet is a member of this IP set. |
Parameters: | other – an IP set |
---|---|
Returns: | True if this IP set is equivalent to the other IP set, False otherwise. |
Parameters: | other – an IP set. |
---|---|
Returns: | True if every IP address and subnet in other IP set is found within this one. |
Returns: | Pickled state of an IPSet object. |
---|
Parameters: | other – an IP set. |
---|---|
Returns: | True if this IP set is greater than the other IP set, False otherwise. |
Raises TypeError if this method is called.
Note
IPSet objects are not hashable and cannot be used as dictionary keys or as members of other sets.
Constructor.
Parameters: |
|
---|
Returns: | an iterator over the IP addresses within this IP set. |
---|
Parameters: | other – an IP set. |
---|---|
Returns: | True if every IP address and subnet in this IP set is found within other. |
Returns: | the cardinality of this IP set (i.e. sum of individual IP addresses). Raises IndexError if size > maxint (a Python limitation). Use the .size property for subnets of any size. |
---|
Parameters: | other – an IP set |
---|---|
Returns: | True if this IP set is less than the other IP set, False otherwise. |
Parameters: | other – an IP set |
---|---|
Returns: | False if this IP set is equivalent to the other IP set, True otherwise. |
Return True if IPSet contains at least one IP, else False
Parameters: | other – an IP set. |
---|---|
Returns: | the union of this IP set and another as a new IP set (combines IP addresses and subnets from both sets). |
Returns: | Python statement to create an equivalent object |
---|
Parameters: | state – data used to unpickle a pickled IPSet object. |
---|
Returns: | Python statement to create an equivalent object |
---|
Parameters: | other – an IP set. |
---|---|
Returns: | the difference between this IP set and another as a new IP set (all IP addresses and subnets that are in this IP set but not found in the other.) |
Parameters: | other – an IP set. |
---|---|
Returns: | the symmetric difference of this IP set and another as a new IP set (all IP addresses and subnets that are in exactly one of the sets). |
Adds an IP address or subnet or IPRange to this IP set. Has no effect if it is already present.
Note that where possible the IP address or subnet is merged with other members of the set to form more concise CIDR blocks.
Parameters: |
|
---|
Remove all IP addresses and subnets from this IP set.
Compact internal list of IPNetwork objects using a CIDR merge.
Returns: | a shallow copy of this IP set. |
---|
Parameters: | other – an IP set. |
---|---|
Returns: | the difference between this IP set and another as a new IP set (all IP addresses and subnets that are in this IP set but not found in the other.) |
Parameters: | other – an IP set. |
---|---|
Returns: | the intersection of this IP set and another as a new IP set. (IP addresses and subnets common to both sets). |
Generates an IPRange for this IPSet, if all its members form a single contiguous sequence.
Raises ValueError if the set is not contiguous.
Returns: | An IPRange for all IPs in the IPSet. |
---|
Returns True if the members of the set form a contiguous IP address range (with no gaps), False otherwise.
Returns: | True if the IPSet object is contiguous. |
---|
Parameters: | other – an IP set. |
---|---|
Returns: | True if this IP set has no elements (IP addresses or subnets) in common with other. Intersection must be an empty set. |
Parameters: | other – an IP set. |
---|---|
Returns: | True if every IP address and subnet in this IP set is found within other. |
Parameters: | other – an IP set. |
---|---|
Returns: | True if every IP address and subnet in other IP set is found within this one. |
Returns: | an iterator over individual IP subnets within this IP set. |
---|
Generate the merged IPRanges for this IPSet.
In contrast to self.iprange(), this will work even when the IPSet is not contiguous. Adjacent IPRanges will be merged together, so you get the minimal number of IPRanges.
Removes and returns an arbitrary IP address or subnet from this IP set.
Returns: | An IP address or subnet. |
---|
Removes an IP address or subnet or IPRange from this IP set. Does nothing if it is not already a member.
Note that this method behaves more like discard() found in regular Python sets because it doesn’t raise KeyError exceptions if the IP address or subnet is question does not exist. It doesn’t make sense to fully emulate that behaviour here as IP sets contain groups of individual IP addresses as individual set members using IPNetwork objects.
Parameters: |
|
---|
The cardinality of this IP set (based on the number of individual IP addresses including those implicitly defined in subnets).
Parameters: | other – an IP set. |
---|---|
Returns: | the symmetric difference of this IP set and another as a new IP set (all IP addresses and subnets that are in exactly one of the sets). |
Parameters: | other – an IP set. |
---|---|
Returns: | the union of this IP set and another as a new IP set (combines IP addresses and subnets from both sets). |
Update the contents of this IP set with the union of itself and other IP set.
Parameters: |
|
---|
The following are a set of useful helper functions related to the various format supported in this library.
Matches an IP address or subnet against a given sequence of IP addresses and subnets.
Parameters: |
|
---|---|
Returns: | all matching IPAddress and/or IPNetwork objects from the provided sequence, an empty list if there was no match. |
A function that converts abbreviated IPv4 CIDRs to their more verbose equivalent.
Parameters: | abbrev_cidr – an abbreviated CIDR. |
---|
Uses the old-style classful IP address rules to decide on a default subnet prefix if one is not explicitly provided.
Only supports IPv4 addresses.
Examples
10 - 10.0.0.0/8
10/16 - 10.0.0.0/16
128 - 128.0.0.0/16
128/8 - 128.0.0.0/8
192.168 - 192.168.0.0/16
Returns: | A verbose CIDR from an abbreviated CIDR or old-style classful network address. The original value if it was not recognised as a supported abbreviation. |
---|
Removes an exclude IP address or subnet from target IP subnet.
Parameters: |
|
---|---|
Returns: | list of IPNetwork objects remaining after exclusion. |
A function that accepts an iterable sequence of IP addresses and subnets merging them into the smallest possible list of CIDRs. It merges adjacent subnets where possible, those contained within others and also removes any duplicates.
Parameters: | ip_addrs – an iterable sequence of IP addresses and subnets. |
---|---|
Returns: | a summarized list of IPNetwork objects. |
A function that accepts an arbitrary start and end IP address or subnet and returns a list of CIDR subnets that fit exactly between the boundaries of the two with no overlap.
Parameters: |
|
---|---|
Returns: | a list of one or more IP addresses and subnets. |
A generator that produces IPAddress objects between an arbitrary start and stop IP address with intervals of step between them. Sequences produce are inclusive of boundary IPs.
Parameters: |
|
---|---|
Returns: | an iterator of one or more IPAddress objects. |
Parameters: | args – A list of IP addresses and subnets passed in as arguments. |
---|---|
Returns: | A generator that flattens out IP subnets, yielding unique individual IP addresses (no duplicates). |
Matches an IP address or subnet against a given sequence of IP addresses and subnets.
Parameters: |
|
---|---|
Returns: | the largest (least specific) matching IPAddress or IPNetwork object from the provided sequence, None if there was no match. |
Matches an IP address or subnet against a given sequence of IP addresses and subnets.
Parameters: |
|
---|---|
Returns: | the smallest (most specific) matching IPAddress or IPNetwork object from the provided sequence, None if there was no match. |
Function that accepts a sequence of IP addresses and subnets returning a single IPNetwork subnet that is large enough to span the lower and upper bound IP addresses with a possible overlap on either end.
Parameters: | ip_addrs – sequence of IP addresses and subnets. |
---|---|
Returns: | a single spanning IPNetwork subnet. |
A MAC address is the 48-bit hardware address associated with a particular physical interface on a networked host. They are found in all networked devices and serve to identify (layer 2) frames in the networking stack.
The EUI class is used to represents MACs (as well as their larger and less common 64-bit cousins).
An IEEE EUI (Extended Unique Identifier).
Both EUI-48 (used for layer 2 MAC addresses) and EUI-64 are supported.
Input parsing for EUI-48 addresses is flexible, supporting many MAC variants.
Returns: | True if this EUI object is numerically the same as other, False otherwise. |
---|
Returns: | True if this EUI object is numerically greater or equal in value to other, False otherwise. |
---|
Returns: | The integer value of the word referenced by index (both positive and negative). Raises IndexError if index is out of bounds. Also supports Python list slices for accessing word groups. |
---|
Returns: | Pickled state of an EUI object. |
---|
Returns: | True if this EUI object is numerically greater in value than other, False otherwise. |
---|
Returns: | hash of this EUI object suitable for dict keys, sets etc |
---|
Constructor.
Parameters: |
|
---|
Returns: | True if this EUI object is numerically lower or equal in value to other, False otherwise. |
---|
Returns: | True if this EUI object is numerically lower in value than other, False otherwise. |
---|
Returns: | True if this EUI object is numerically the same as other, False otherwise. |
---|
Returns: | executable Python string to recreate equivalent object. |
---|
Set the value of the word referenced by index in this address
Parameters: | state – data used to unpickle a pickled EUI object. |
---|
Returns: | EUI in representational format |
---|
The value of this EUI adddress in standard Python binary representational form (0bxxx). A back port of the format provided by the builtin bin() function found in Python 2.6.x and higher.
Parameters: | word_sep – (optional) the separator to insert between words. Default: None - use default separator for address type. |
---|---|
Returns: | human-readable binary digit string of this address. |
a Python class providing support for the interpretation of various MAC address formats.
The EI (Extension Identifier) for this EUI
Returns: | The value of this EUI object as a new 64-bit EUI object. |
---|
If is_iab() is True, the IAB (Individual Address Block) is returned, None otherwise.
A record dict containing IEEE registration details for this EUI (MAC-48) if available, None otherwise.
Note
This poses security risks in certain scenarios. Please read RFC 4941 for details. Reference: RFCs 4291 and 4941.
Parameters: | prefix – ipv6 prefix |
---|---|
Returns: | new IPv6 IPAddress object based on this EUI using the technique described in RFC 4291. |
Note
This poses security risks in certain scenarios. Please read RFC 4941 for details. Reference: RFCs 4291 and 4941.
Returns: | new link local IPv6 IPAddress object based on this EUI using the technique described in RFC 4291. |
---|
Returns: | True if this EUI is an IAB address, False otherwise |
---|
Returns: | a new and modified 64-bit EUI object. |
---|
The OUI (Organisationally Unique Identifier) for this EUI.
The value of this EUI address as a packed binary string.
a positive integer representing the value of this EUI indentifier.
The EUI version represented by this EUI object.
A list of unsigned integer octets found in this EUI address.
An individual IEEE OUI (Organisationally Unique Identifier).
For online details see - http://standards.ieee.org/regauth/oui/
Returns: | Pickled state of an OUI object. |
---|
Constructor
Parameters: | oui – an OUI string XX-XX-XX or an unsigned integer. Also accepts and parses full MAC/EUI-48 address strings (but not MAC/EUI-48 integers)! |
---|
Returns: | executable Python string to recreate equivalent object. |
---|
Parameters: | state – data used to unpickle a pickled OUI object. |
---|
Returns: | string representation of this OUI |
---|
Number of registered organisations with this OUI
The IEEE registration details for this OUI.
Parameters: | index – the index of record (may contain multiple registrations) (Default: 0 - first registration) |
---|---|
Returns: | Objectified Python data structure containing registration details. |
An individual IEEE IAB (Individual Address Block) identifier.
For online details see - http://standards.ieee.org/regauth/oui/
Returns: | Pickled state of an IAB object. |
---|
Constructor
Parameters: |
|
---|
Returns: | executable Python string to recreate equivalent object. |
---|
Parameters: | state – data used to unpickle a pickled IAB object. |
---|
Returns: | string representation of this IAB |
---|
The IEEE registration details for this IAB
Parameters: |
|
---|
The following dialects are used to specify the formatting of MAC addresses.
A bare (no delimiters) MAC address dialect class.
A Cisco ‘triple hextet’ MAC address dialect class.
A standard IEEE EUI-48 dialect class.
The maximum integer value for an individual word in this address type.
The number of words in this address type.
The number base to be used when interpreting word values as integers.
The format string to be used when converting words to string values.
The separator character used between each word.
The individual word size (in bits) of this address type.
A PostgreSQL style (2 x 24-bit words) MAC address dialect class.
A UNIX-style MAC address dialect class.
Parameters: |
|
---|---|
Returns: | True if IPv4 address is valid, False otherwise. |
Parameters: |
|
---|---|
Returns: | True if IPv6 address is valid, False otherwise. |
Parameters: | ipglob – An IP address range in a glob-style format. |
---|---|
Returns: | True if IP range glob is valid, False otherwise. |
Parameters: | addr – An IEEE EUI-48 (MAC) address in string form. |
---|---|
Returns: | True if MAC address string is valid, False otherwise. |
Who said networking was all about being serious? It’s always good to lighten up and have a bit of fun.
Let’s face it, no networking library worth its salt would be complete without support for RFC 1924 - http://www.ietf.org/rfc/rfc1924 :-)
Convert a base 85 IPv6 address to its hexadecimal format.
Convert a regular IPv6 address to base 85.