What is best database or search service to store and search for millions of ip addresses?


A customer has millions of potential IP addresses in IP ranges they set up. They are looking for ways to easily search to see if a certain range or specific IP address belongs to their strings. The way they do it now is they have a script they run and it takes a while to return the info.

They are looking for a way to easily search a specific IP address or range and see if it belongs to them. I am leaning along the lines of elastic search, DocumentDB or DynamoDB but am unsure which option would be best for them. If anyone has any insights, please advise. If anyone also has seen blog posts or sample databases for such a use case, please also share.

Much thanks!

1 Answer
Accepted Answer

The answer depends on a number of factors, including whether you are using IPv4 or IPv6 addresses (or both), whether you are tracking individual addresses, subnets, or both, and whether you need to store additional attributes other than just the address range.

One approach for IPv4 lookup is to convert the ip address to an integer, store the integer in a DocumentDB document with associated metadata, and use simple $eq queries to match relevant documents. https://stackoverflow.com/questions/18281696/mongodb-network-subnet-lookup has an example of a similar approach.

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions