最後更新: 2024-08-15
目錄
- Free IP geolocation databases
- Lookup Tools - mmdblookup
- 應用: xt_geoip
- 應用: Nginx
- 應用: Apache
Free IP geolocation databases
The DB-IP Lite databases are subsets of the commercial databases with reduced coverage and accuracy.
Lite downloads are updated monthly and distributed under the Creative Commons Attribution License.
mkdir /usr/src/dbip; cd /usr/src/dbip
wget "https://download.db-ip.com/free/dbip-country-lite-$(date +'%Y-%m').csv.gz"
wget "https://download.db-ip.com/free/dbip-country-lite-$(date +'%Y-%m').mmdb.gz"
gzip -dk dbip-country-lite-$(date +'%Y-%m').mmdb.gz
Lookup Tools - mmdblookup
apt install mmdb-bin # 獲得 /usr/bin/mmdblookup
Usage
mmdblookup --file [FILE PATH] --ip [IP ADDRESS] [DATA PATH]
-f, --file # The path to the MMDB file. Required.
-i, --ip # The IP address to look up. Required.
* If you do not provide a "DATA PATH" to lookup,
all of the information for a given IP will be shown.
e.g. DATA PATH: country iso_code
mmdb=/usr/src/dbip/dbip-country-lite-2024-08.mmdb
mmdblookup -f $mmdb -i 8.8.8.8 country iso_code
"US" <utf8_string>
應用: Nginx
module: ngx_http_geoip2_module
creates variables with values from a MMDB database based on the client IP (default)
應用: Apache
module: mod_maxminddb
allows you to query MMDB files from Apache 2.2+ using the libmaxminddb library.