def ip_to_int(ip):
    """
    convert ip(ipv4) address to a int num
    :param ip:
    :return: int num
    """

    lp = [int(x) for x in ip.split('.')]
    return lp[0] << 24 | lp[1] << 16 | lp[2] << 8 | lp[3]