supernet(prefixlen_diff=1, new_prefix=None)
The supernet containing this network definition, depending on the argument values. prefixlen_diff is the amount our prefix length should be decreased by. new_prefix is the desired new prefix of the supernet; it must be smaller than our prefix. One and only one of prefixlen_diff and new_prefix must be set. Returns a single network object.
1 2 3 4 5 6 | >>> ip_network( '192.0.2.0/24' ).supernet() IPv4Network( '192.0.2.0/23' ) >>> ip_network( '192.0.2.0/24' ).supernet(prefixlen_diff=2) IPv4Network( '192.0.0.0/22' ) >>> ip_network( '192.0.2.0/24' ).supernet(new_prefix=20) IPv4Network( '192.0.0.0/20' ) |
Please login to continue.