I am using python-netaddr library to work on IP Addresses and subnets. I read the full documentaion of netaddrd given: Netaddr documentation. But didn't found any solution to my problem. I have a IP Address and subnet i want to get prefix for that ip by using both of them. So that i can print all of the ip coming into the subnet.
For example:
Ip Address: 192.0.2.0
Subnet Network: 255.255.255.0
It should return the prefix which is : 24
IPAddress('192.0.2.0/255.255.255.0')
? You can get a list of all addresses in that subnet, with an example in the documentation you linked to. – Aristate/24
is a way of represent the mask255.255.255.0
which is also11111111.11111111.11111111.00000000
– Nadene