In this section, you will explore TCP/IP networking using Python scripts.
Using Python to manipulate IP addresses and perform CIDR calculations
The Python ipaddress module
The ipaddress module simplifies working with IPv4 and IPv6 addresses in Python. In this section, we will focus on IPv4 and will work primarily with the following three class types:
- IPv4Address: Represents a single IPv4 address
- IPv4Network: Represents an IPv4 network
- IPv4Interface: Represents an IPv4 interface
You can get more information about this module with the help command from the Python interpreter:
IPv4Address is the class that represents and manipulates single IPv4 addresses:
The class represents an IPv4 address or network. To create these objects...