You can use Patricia Trie to filter IP addresses. I believe most network routers use this data structure for IPV4 IP addresses. There are also other attempts in the literature for IP addresses that you can use. Here is one of them: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.35.4871
Responding to each IP address, you can now have a hash table based on the identifier.
If the IP addresses are βrandom enoughβ, you might be better off using a hash table for IP-based filtering, although since the IP addresses fit nicely into the words of most machines, making a hash search very fast and trie may not really save you a lot of space.
Of course, the right choice depends on your situation ...
Aryabhatta
source share