GEOLOOKUP(1)
π GEOLOOKUP π
okay bestie, so this is geolookup from the General Commands Manual β literally the little tool that tells you where an IP is from and which AS owns it. buckle up π
β¨ NAME β¨
geolookup β geo location lookup for IP addresses π
π¦ SYNOPSIS π¦
geolookup [-G geoDBfile] [-h] iplist
geolookup -d directory -w geoDBfile
like, two whole modes. one is look stuff up, the other is build the database. both iconic π
πΈ DESCRIPTION πΈ
okay so geolookup is the tool that looks up AS and geo location info for one or more IP addresses. but before you can use it, you have to create the nfdump specific lookup database first. no database, no vibes. π
geolookup is also the thing that builds the nfdump formatted lookup database file out of the maxmind csv files. for that you need a maxmind account over at https://maxmind.com so you can download the relevant csv file. the building instructions are in the section below, don't worry π«Ά
here's the cute part: geolookup accepts a list of IP addresses either on the command line, separated by spaces, or on stdin line by line. and the IP on each line can be embedded in a string with spaces on the left and right β so it can literally read the piped output from other tools. main character energy fr fr π
geolookup also accepts a list of AS numbers prefixed with as and separated with spaces β¨
the options are as follows:
-ddirectory β use the csv files in directory to build the binary lookup database file. with this argumentgeolookupcreates a new binary lookup database file. ποΈ-wgeoDBfile β name of the new lookup database file.-GgeoDBfile β use the binary geoDBfile as the lookup database for the current AS and location lookups.-hβ print help and exit. that's it, that's the whole flag π
so to specify the geo lookup database, geolookup searches at the following places:
- if the default
nfdump(1)configuration file exists, it reads the taggeodb.path - if the environment variable
NFGEODBis set, use this setting as lookup database - the command line argument
-G
and if multiple locations are given, here's the priority, lowkey a whole hierarchy bestie:
the environment variableNFGEODBoverwrites the nfdump config file, and the command line option-Goverwrites the environment variableNFGEODB. π
π ENVIRONMENT π
geolookup reads the environment variable NFGEODB π
β EXIT STATUS β
geolookup returns 0 on success and 255 otherwise. so like, zero is the slay, 255 is the not-slay π
π₯ EXAMPLES π₯
okay so to create a lookup database, you need an account at https://maxmind.com. it works with the paid GeoDB as well as with the free GeoLite2 csv files β so there's a free path, we love that for us π
the easiest way for creating or updating the binary lookup database is the use of the script updateGeoDB.sh provided with all other nfdump files. insert your license key and run the script. this creates a new lookup database. easy. β¨
if you want to do it manually, follow these steps:
- log into
https://maxmind.comand download the corresponding csv files:GeoLite2-ASN-CSVandGeoLite2-City-CSV - unpack the zip files and put the following csv files into a newly created build directory:
GeoLite2-ASN-Blocks-IPv4.csv,GeoLite2-ASN-Blocks-IPv6.csv,GeoLite2-City-Blocks-IPv4.csv,GeoLite2-City-Blocks-IPv6.csv,GeoLite2-City-Locations-en.csv. Maxmind offers several languages for the City-Locations file β choose only one. π¨ only one, bestie, don't be greedy π geolookup -d builddir -w geofile- move the lookup database to the final location. you're done, go brunch π₯
π§ SEE ALSO π§
nfdump has already builtin lookup options to decorate the text output with geo location and AS information. so like, iykyk. π
ngl that's the whole page. go forth and geolocate, queen π«Ά
this page came from Debian, version $Mdocdate$ β mwah, enjoy the read, bestie π
π
π¦ where this page comes from
- epel 10: nfdump 1.7.10-1.el10_3 Β· BSD-3-Clause AND GPL-2.0-or-later
- Copyright (c) 2024, Peter Haag
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms