ipinfo.mmdb.gz
完整记录,MaxMind DB 格式(IPv4 和 IPv6)
685 MB
- 适合
- 在应用内查询:输入一个地址,几微秒内返回一条记录。
- 打开方式
- 任何 MaxMind 读取器:maxminddb(Python)、maxmind(Node)、geoip2、mmdbctl
零件目录
本周版本的所有文件,附大小、行数和 SHA-256。数据与 API 相同。可以保存、离线查询,也可以打包进你的产品。
01 · 主版本
我们掌握的每个地址段的全部信息,五种格式,全部经过 gzip 压缩。如果只需要查询,从 MMDB 开始。
完整记录,MaxMind DB 格式(IPv4 和 IPv6)
扁平列,每个地址段一行
每个地址段一条嵌套 JSON 记录
规范化的表、视图和一张 ASN 概况表
适用于 SQLite、PostgreSQL 和 MySQL 的 CREATE TABLE + INSERT
为了下载更快,所有文件都经过 gzip 压缩:整个版本共 9.5 GB。用 gunzip 解压(或用 zcat 流式读取)。
02 · 网络
每个 AS 一行或一个对象:所有者、注册身份、排名、邻居、RPKI、滥用率、PeeringDB 数据。
每个自治系统一行
每个自治系统一份 JSON 概况
03 · 专项数据库
完整记录中面向单一用途的子集。文件更小,版本相同,准确度相同。
| 数据库 | MMDB | CSV |
|---|---|---|
| abuse每个地址段的滥用投诉联系人9,041,478 行 | ||
| asn-ip每个地址段的 ASN、路由和 RPKI1,488,551 行 | ||
| carrier移动运营商地址段30,498 行 | ||
| company每个地址块的注册所有者9,653,085 行 | ||
| country-asn国家和 ASN1,257,842 行 | ||
| country仅国家890,727 行 | ||
| datacenter托管和云地址段1,661,035 行 | ||
| geolocation仅位置字段7,782,489 行 | ||
| hosted-domains每个地址段上托管的热门域名1,058,094 行 | ||
| privacy仅含 VPN、代理、Tor、中继和托管标记5,139,115 行 | ||
| ziplite精简版:公司、国家、城市、ASN、标记、威胁16,353,514 行 |
04 · GeoLite2 直接替换
我们的国家、地理位置和 ASN 文件与 GeoLite2 一样,都是 MaxMind DB(MMDB)文件:你现有的 nginx 模块和 MaxMind DB 读取库可以直接打开。改一下文件路径,换几个字段名,就完成了。
# ngx_http_geoip2_module
# GeoLite2-Country.mmdb → country.mmdb
# country iso_code → country_code
geoip2 /etc/nginx/country.mmdb {
$geoip2_country_code country_code;
}
# GeoLite2-City.mmdb → geolocation.mmdb
# city names en → city
geoip2 /etc/nginx/geolocation.mmdb {
$geoip2_city city;
}
# pip install maxminddb
import maxminddb
# GeoLite2-City.mmdb → geolocation.mmdb
db = maxminddb.open_database('geolocation.mmdb')
rec = db.get('8.8.8.8')
# ['country']['iso_code'] → ['country_code'], ['city']['names']['en'] → ['city']
print(rec['country_code'], rec.get('city'))
// npm i maxmind
import maxmind from 'maxmind';
// GeoLite2-ASN.mmdb → asn-ip.mmdb
const db = await maxmind.open('asn-ip.mmdb');
const rec = db.get('8.8.8.8');
// autonomous_system_number → asn, autonomous_system_organization → as_name
console.log(rec.asn, rec.as_name);
curl -LO https://ipinfo.zip/download/country.mmdb
curl -LO https://ipinfo.zip/download/geolocation.mmdb
curl -LO https://ipinfo.zip/download/asn-ip.mmdb
# crontab (UTC): 0 6 * * 1
| GeoLite2 路径 | IPINFO.ZIP 字段 |
|---|---|
| country. | country_ |
| country. | country |
| continent. | continent_ |
| continent. | continent |
| country. | is_ |
| GeoLite2 路径 | IPINFO.ZIP 字段 |
|---|---|
| country. | country_ |
| subdivisions[0]. | region |
| city. | city |
| city. | geoname_ |
| postal. | postal |
| location. | latitude |
| location. | longitude |
| location. | timezone |
| location. | accuracy_ |
| GeoLite2 路径 | IPINFO.ZIP 字段 |
|---|---|
| autonomous_ | asn |
| autonomous_ | as_ |
05 · 用法
MMDB 可用于所有 MaxMind 读取库。CSV 和 NDJSON 什么工具都能用。SQLite 文件包含一个联结所有数据的视图。
# pip install maxminddb (after: gunzip ipinfo.mmdb.gz)
import maxminddb
with maxminddb.open_database('ipinfo.mmdb') as db:
ip = db.get('8.8.8.8')
print(ip['location']['country_code'], ip['asn']['asn'])
// npm i maxmind (after: gunzip ipinfo.mmdb.gz)
import maxmind from 'maxmind';
const db = await maxmind.open('ipinfo.mmdb');
const ip = db.get('8.8.8.8');
console.log(ip.location.country_code, ip.asn.asn);
// go get github.com/oschwald/maxminddb-golang/v2
db, err := maxminddb.Open("ipinfo.mmdb")
if err != nil {
log.Fatal(err)
}
defer db.Close()
var rec map[string]any
db.Lookup(netip.MustParseAddr("8.8.8.8")).Decode(&rec)
fmt.Println(rec["location"])
<?php
// composer require maxmind-db/reader
require 'vendor/autoload.php';
$db = new MaxMind\Db\Reader('ipinfo.mmdb');
$ip = $db->get('8.8.8.8');
echo $ip['location']['country_code'], ' ', $ip['asn']['asn'];
-- gunzip -k ipinfo.sqlite.gz && sqlite3 ipinfo.sqlite
SELECT * FROM ip_ranges
WHERE end_int >= 134744072 -- 8.8.8.8 as an integer
ORDER BY end_int LIMIT 1;
curl -LO https://ipinfo.zip/download/ipinfo.mmdb.gz
echo "df6faaa49803e1f68479a354171919be605384440c6ee47e1c699c55afc6e1c4 ipinfo.mmdb.gz" | sha256sum -c
gunzip ipinfo.mmdb.gz
mmdbctl read 8.8.8.8 ipinfo.mmdb
zcat ipinfo.csv.gz | head -3
zcat ipinfo.ndjson.gz | jq -c 'select(.is_tor)' | head
06 · 记录结构
MMDB、NDJSON 和 API 共用同一种嵌套记录。CSV 将其展平为列。
| 字段 | 类型 | 说明 |
|---|---|---|
| ip | string | 你查询的地址,已规范化(IPv6 压缩表示,IPv4 映射地址已解包)。 |
| network | string | 数据库中包含该地址的最小地址段的 CIDR。 |
| type | string | IPv4 或 IPv6。 |
| tags | string[] | 所有为 true 的 is_* 标记,以简短标签形式按固定顺序列出(如 hosting、vpn、tor)。 |
| is_bogon | boolean | 保留、私有、文档用途或未分配的地址空间,不应出现在互联网上。 |
| is_announced | boolean | 生成本周版本时,覆盖该地址的前缀在全球 BGP 路由表中可见。 |
| is_datacenter | boolean | 托管、云、主机托管(colocation)或 CDN 地址空间。 |
| is_cloud_provider | boolean | 公有云公布的地址段(AWS、Google Cloud、Azure、Oracle 等)。 |
| is_mobile | boolean | 蜂窝网络(移动运营商 geofeed、运营商标签或纯移动运营商)。 |
| is_satellite | boolean | 卫星互联网接入(如 Starlink)。 |
| is_anycast | boolean | 任播(Anycast)前缀:同一地址由多个地点提供服务。 |
| is_ixp | boolean | 互联网交换中心的对等互联局域网。 |
| is_crawler | boolean | 搜索引擎、AI 爬虫或在线监测服务公布的地址段。 |
| is_scanner | boolean | 已知的全网扫描器(研究或商业用途)。 |
| is_vpn | boolean | VPN 出口服务器,来自服务商的服务器列表和解析出的主机名。 |
| is_proxy | boolean | 代理列表中出现的开放或公共代理。 |
| is_residential_proxy | boolean | 近期被发现转发机器人或代理流量的住宅地址。 |
| is_tor | boolean | Tor 中继(无论是否为出口节点)。 |
| is_relay | boolean | 隐私中继出口(iCloud Private Relay、Cloudflare WARP 等)。 |
| is_anonymous | boolean | VPN、代理、Tor 或中继中的任意一种。 |
| is_abuser | boolean | 最近 30 天内被至少一个滥用名单或黑名单列出。 |
| is_attacker | boolean | 因攻击被列出:暴力破解、漏洞利用、扫描或僵尸网络控制。 |
| is_threat | boolean | 威胁评分不低于 50。 |
| is_drop | boolean | 位于 Spamhaus DROP 地址段或 ASN-DROP 网络中。 |
| is_mail_blocklisted | boolean | 该地址本身列在邮件黑名单上(UCEPROTECT 1 级、PSBL、blocklist.de mail)。整段网络的列入不会设置此项。 |
| is_leased | boolean | 租用的地址空间:登记在一个持有者名下,却由另一个网络宣告和使用,通常经由 IPXO 等租赁平台。 |
| usage_type | string | IP2Location 风格的代码:DCH、CDN、ISP、MOB、COM、ORG、EDU、GOV、MIL、LIB、SES 或 RSV。 |
| connection_type | string | 地址的连接方式:Cable/DSL、Cellular、Satellite 或 Corporate。 |
| user_type | string | 使用者类型:residential、business、hosting、cellular、college、government、military、consumer_privacy_network、content_delivery_network 或 search_engine_spider。 |
| rir | string | 区域互联网注册机构:ARIN、RIPE、APNIC、LACNIC 或 AFRINIC。 |
| hostname | string | 已知服务器名(仅限 VPN 或 Tor 服务器;不做 PTR 爬取)。 |
| location.country_code | string | ISO 3166-1 alpha-2 国家代码。 |
| location.country | string | 国家英文名称。 |
| location.continent | string | 两个字母的大洲代码。 |
| location.state | string | 州、地区或省份。 |
| location.city | string | 城市。 |
| location.zip | string | 邮政编码(来源提供时)。 |
| location.latitude | number | 纬度,十进制度数。 |
| location.longitude | number | 经度,十进制度数。 |
| location.accuracy | string | 根据各来源的一致程度给出的定位可信度:COUNTRY(无城市)、LOW、MEDIUM、HIGH 或 VERY_HIGH。 |
| location.accuracy_radius | number | 地址最可能所在范围的半径(公里)。 |
| location.timezone | string | IANA 时区。 |
| location.local_time | string | 当前当地时间及 UTC 偏移(由 API 添加)。 |
| location.is_eu_member | boolean | 该国是否为欧盟成员国。 |
| location.currency_code | string | 该国的 ISO 4217 货币代码。 |
| location.calling_code | string | 国际电话区号。 |
| asn.asn | integer | 宣告该地址的自治系统号。 |
| asn.name | string | AS 简称。 |
| asn.org | string | 持有该 AS 的组织。 |
| asn.domain | string | AS 运营方的主域名。 |
| asn.country | string | AS 的注册国家/地区。 |
| asn.type | string | isp、hosting、business、education、government 或 banking。 |
| asn.rir | string | AS 的注册机构。 |
| asn.registered | string | AS 号的分配日期(YYYY-MM-DD)。 |
| asn.rank | integer | 按客户锥大小的全球排名(1 = 最大)。 |
| asn.abuser_score | number | 该 AS 的地址中出现在滥用名单上的比例(0..1)。 |
| asn.abuser_level | string | 该 AS 滥用率的等级:Very Low、Low、Elevated、High 或 Very High。 |
| asn.route | string | 覆盖该地址的已宣告前缀。 |
| asn.rpki_status | string | 路由源验证结果:valid、invalid 或 unknown。 |
| company.name | string | 地址块的注册组织(注册机构 whois / RDAP)。 |
| company.domain | string | 该组织的主域名。 |
| company.type | string | isp、hosting、business、education、government 或 banking。 |
| company.network | string | 注册的地址块(起始 - 结束)。 |
| company.netname | string | 注册机构中的网络名。 |
| company.abuser_score | number | 该地址块中出现在滥用名单上的比例(0..1)。 |
| company.abuser_level | string | 该地址块滥用率的等级:Very Low、Low、Elevated、High 或 Very High。 |
| abuse.name | string | 滥用投诉联系人名称。 |
| abuse.email | string | 滥用投诉联系邮箱。 |
| abuse.phone | string | 滥用投诉联系电话。 |
| abuse.address | string | 滥用投诉联系人邮寄地址。 |
| registry.rir | string | 委派该地址块的注册机构。 |
| registry.allocated | string | 委派日期。 |
| registry.status | string | allocated 或 assigned。 |
| registry.registrant.name | string | 该 IP 地址块的注册人。 |
| routing.route | string | 已宣告的 BGP 前缀。 |
| routing.origin_asns | integer[] | 源 AS 号(前缀有多个源 AS 时为多个)。 |
| routing.rpki_status | string | 基于已发布 ROA 的路由源验证结果。 |
| routing.visibility | number | 能看到该路由的 RIPE RIS 对等方比例(0..1)。 |
| routing.first_seen | string | 首次发现该前缀被宣告的日期。 |
| routing.last_seen | string | 最后发现该前缀被宣告的日期。 |
| threat.score | integer | 0–100,根据黑名单、DROP、Tor 出口节点和滥用举报加权计算。 |
| threat.level | string | none、low、medium、high 或 critical。 |
| threat.categories | string[] | attacker、bruteforce、botnet_c2、spam、malware、compromised、malicious_network 等。 |
| abuser.lists | string[] | 当前列出该地址的黑名单。 |
| mail_blocklists | string[] | 列出该地址的邮件黑名单,包括只反映其所在网络的整段列入(UCEPROTECT 2 级)。 |
| privacy.service | string | 已知时为 VPN 或中继品牌。 |
| datacenter.datacenter | string | 托管或云服务商名称。 |
| datacenter.region | string | 云区域(如有公布)。 |
| vpn.service | string | VPN 品牌。 |
| vpn.type | string | VPN 出口的检测方式:enumerated(服务商列表)、observed、interpolated 或 whois。 |
| proxy.type | string | open、public、http、https、socks、residential 或 tunnel。 |
| tor.exit | boolean | 该 Tor 中继允许出口流量。 |
| relay.service | string | 隐私中继运营方。 |
| carrier.name | string | 移动运营商。 |
| carrier.mcc | string | 移动国家代码(MCC)。 |
| carrier.mnc | string | 移动网络代码(MNC)。 |
| crawler.name | string | 爬虫或监测服务名称。 |
| scanner.name | string | 扫描器所属组织。 |
| drop.sblid | string | DROP 条目对应的 Spamhaus SBL 编号。 |
| lease.broker | string | 注册对象中出现的租赁平台或出租方(例如 IPXO),如已知。 |
| lease.network | string | 注册记录中的租用地址块(承租方的子分配)。 |
| lease.registry_country | string | 持有者所获分配的登记国家/地区。对于租用空间,它常与地址块的实际使用地不同。 |
| lease.holder_country | string | 租用地址块自身注册对象上的国家(IPXO 写作 EU)。 |
| abuse_density.subnet24_ips | integer | 该地址所在 /24 中已宣告的地址数。 |
| abuse_density.subnet24_abusive | integer | 该 /24 中被标记为滥用的地址数(滥用、攻击、威胁、DROP 或邮件黑名单)。 |
| abuse_density.subnet24_abusive_share | number | subnet24_abusive / subnet24_ips,取值 0 到 1。 |
| abuse_density.asn_ips | integer | 源 AS 宣告的 IPv4 地址数。 |
| abuse_density.asn_abusive | integer | 源 AS 中被标记为滥用的 IPv4 地址数。 |
| abuse_density.asn_abusive_share | number | asn_abusive / asn_ips,取值 0 到 1。 |
| release | string | 应答所用数据集的发布日期(YYYY-MM-DD)。 |
| elapsed_ms | number | 服务器端查询耗时(毫秒)。 |
MMDB 压缩:省略值为 false 的布尔字段、null 字段和 tags 列表;API 会将它们补全。