Retooled with NetAddr::IP so that the script can handle ipv6.