'How do I get the first IP and the last IP given any address (followed by its subnet mask) given any other address than the subnet's network address?
The following code:
from ipaddress import IPv4Network
n = IPv4Network('192.168.18.100/24')
first, last = n[0], n[-1]
print(first)
print(last)
returns ValueError: 192.168.18.100/24 has host bits set
when given any other address from the subnet than its network address.
How do I get in Python the first IP and the last IP given any address (followed by its subnet mask) given any other address than the subnet's network address?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
