mmdblookup
Look up an IP address in a MaxMind DB file
TLDR
SYNOPSIS
mmdblookup --file FILE --ip ADDRESS [DATAPATH_...]
DESCRIPTION
mmdblookup is the command-line lookup tool shipped with libmaxminddb. It opens a MaxMind DB file, finds the record for an IP address, and prints that record in a type-annotated, JSON-like structure. Maps are shown with `{}` and arrays with `[]`. Each value is followed by a type annotation.If the record is a map or array, extra arguments after --ip form a lookup path into that structure. For example, `country isocode` selects the `isocode` field inside the `country` map, and `cities 1` selects the second element of the `cities` array. With no path, the entire record is printed.The tool does not download databases. Typical inputs are GeoIP2 or GeoLite2 `.mmdb` files obtained from MaxMind (or another MMDB producer) and stored locally.
PARAMETERS
-f, --file FILE
Path to the MaxMind DB (`.mmdb`) file. Required.-i, --ip ADDRESS
IPv4 or IPv6 address to look up. Required.DATAPATH_
Optional key path into the record. Map keys are strings; array indexes are 0-based integers.-v, --verbose
Also print the database metadata.--version
Print the program version and exit.-h, -?, --help
Show usage information.
INSTALL
CAVEATS
Output is not JSON and is not meant to be parsed as JSON. Type annotations and the `{}` / `[]` wrappers make it human-readable only. For machine-readable JSON, MaxMind documents mmdbinspect instead.--file and --ip are both required. A missing database, a path that does not exist in the record, or an address that is not present yields little or no data rather than a GeoIP2-specific error. The command knows nothing about GeoIP2 field names; those keys come from the database you point it at.
HISTORY
mmdblookup was written by Boris Zentner and Dave Rolsky at MaxMind as part of libmaxminddb, the C library for the MaxMind DB format used by GeoIP2 and GeoLite2. The library and this utility first appeared around 2013-2014, when MaxMind replaced the legacy GeoIP format. The project is licensed under Apache 2.0.
