Indexed ranged search algorithm for IP Addresses

后端 未结 3 1608
离开以前
离开以前 2021-02-14 12:52

Given an ACL list with 10 billion IPv4 ranges in CIDR notiation or between two IPs:

x.x.x.x/y
x.x.x.x - y.y.y.y

What is an effecient search/ind

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-14 13:24

    You can look at the Interval tree to find all intervals that overlap with any given interval or point.

    For non-overlapping ip-ranges, you can use a b-tree or compact-tries like Judy arrays (64-bits) for indexing and searching (Store the start-ip as key and the end-ip as value).

提交回复
热议问题