Convert IPs to subnets.