Working and manipulating IP addresses is one of the most important tasks for network engineers. Python developers provide an amazing library that can understand the IP addresses and work on them, called netaddr. For example, assume you developed an application and part of it is to get the network and broadcast address for 129.183.1.55/21. You can do that easily via two built-in methods inside the modules called network and broadcast respectively:
net.network
129.183.0.
net.broadcast
129.183.0.0
In general, netaddr provides support for the following features:
Layer 3 addresses:
- IPv4 and IPv6 addresses, subnets, masks, prefixes
- Iterating, slicing, sorting, summarizing, and classifying IP networks
- Dealing with various range formats (CIDR, arbitrary ranges and globs, nmap)
- Set-based operations (unions, intersections, and so on) over IP...