How to Solve NameError: name 'ipaddress' is not defined

Solution: Import the 'ipaddress' module

# Add the following line to the top of your code
import ipaddress

 

For more information:
Python ipaddress