I have subnet address and mask, and I am looking for possible IP range in that subnet. Please let me know a solution in Python, PHP, or Java.
For example, I have the following details:
Subnet address: 10.113.12.40
mask: 255.255.255.248
Then what will be the IP Range?
10.113. 12. 40 -> 00001010.01110001.00001100.00101000
255.255.255.248 -> 11111111.11111111.11111111.11111000
^^^--- 3 bits for your network
2**3 = 8, so you've got 8 IPs in your network, giving you a range of 10.113.12.40
-> 10.113.12.47
Basically a netmask defines what's "inside" and "outside" your network. Normal bitmask has 1
for outside, and 0
for inside. So a quicker version would be:
10.113.12.40 NOR 255.255.255.248 = 10.113.12.47
^^^^^^^^^^^^^^^---invert the mask and OR it with the network address.