{"id":13462518,"url":"https://github.com/gaoyifan/china-operator-ip","last_synced_at":"2025-05-14T02:05:54.257Z","repository":{"id":37663350,"uuid":"79440833","full_name":"gaoyifan/china-operator-ip","owner":"gaoyifan","description":"中国运营商IPv4/IPv6地址库-每日更新","archived":false,"fork":false,"pushed_at":"2025-05-12T03:24:20.000Z","size":3320,"stargazers_count":3028,"open_issues_count":4,"forks_count":321,"subscribers_count":71,"default_branch":"master","last_synced_at":"2025-05-12T04:28:35.778Z","etag":null,"topics":["asn","bgp","china","daily","ip","ipv6","operator"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gaoyifan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-01-19T10:11:16.000Z","updated_at":"2025-05-12T03:40:51.000Z","dependencies_parsed_at":"2023-11-11T04:21:05.088Z","dependency_job_id":"3a38fb17-e1ad-417c-9086-0fd9b8e641a6","html_url":"https://github.com/gaoyifan/china-operator-ip","commit_stats":{"total_commits":115,"total_committers":5,"mean_commits":23.0,"dds":"0.10434782608695647","last_synced_commit":"88fceffee055939bf59b53b0b8556fcb3178caf6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaoyifan%2Fchina-operator-ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaoyifan%2Fchina-operator-ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaoyifan%2Fchina-operator-ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaoyifan%2Fchina-operator-ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaoyifan","download_url":"https://codeload.github.com/gaoyifan/china-operator-ip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052692,"owners_count":22006716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asn","bgp","china","daily","ip","ipv6","operator"],"created_at":"2024-07-31T12:00:50.567Z","updated_at":"2025-05-14T02:05:49.247Z","avatar_url":"https://github.com/gaoyifan.png","language":"Shell","funding_links":[],"categories":["Uncategorized","Shell","Shell (473)","Just"],"sub_categories":["Uncategorized"],"readme":"# 中国运营商IP地址库\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgaoyifan%2Fchina-operator-ip.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fgaoyifan%2Fchina-operator-ip?ref=badge_shield)\n\n\n依据中国网络运营商分类的IP地址库\n\n## 为什么创造这个项目\n\n在国内，BGP/ASN数据分析的商业服务只有一个[ipip.net](https://www.ipip.net)，是目前运营商IP库准确度最高的服务商，我认为没有之一。\n\n随着互联网规模的增加，为了处理大批量的路由数据，边界网关协议（即BGP，下同）应运而生，是互联网的基础协议之一。为了保证了全球网络路由的可达性，但凡需要在互联网中注册一个IP（段），都需要借助BGP协议对外宣告，这样互联网中的其他自治域才能学习到这段地址的路由信息，其它主机才能成功访问这个IP（段）。因此可以说，BGP数据是最适合分析运营商IP地址的数据来源之一。\n\n但是，目前国内绝大多数IP库都由[WHOIS数据库](https://ftp.apnic.net/apnic/whois/apnic.db.inetnum.gz)作为基础数据来源。WHOIS数据仅表示某个IP被哪个机构注册，但无从知晓该IP被用在何处，这就导致许多非运营商自己注册的IP地址无法被正确分类。ipip.net是最早开始做BGP/ASN数据分析的公司之一，数据准确性甩其它库几条街。但很可惜是，ipip.net作为商业公司，绝大多数高质量的IP数据都是收费的，且价格不菲。\n\n由于在做其他课题时需要处理BGP数据，本着开源精神，我将这部分代码重新封装，创造了这个项目。至于如何使用，大家可以自己发挥想象力。如：[@ustclug](https://github.com/ustclug)将其用在权威DNS服务器上做分域解析；我则借助这个IP库做了一个多出口的网关，访问不同的运营商时走不同的线路（如果都不匹配则走国外vps，原因你懂的）。\n\n但由于个人精力有限，IP库的覆盖率并不及ipip.net，尤其是一些骨干网节点的地址，这些地址往往是核心路由设备或企业托管给运营商的地址，对普通用户影响不大。\n\n如果大家有任何建议或疑问，欢迎提交issue。\n\n## 收录的运营商\n\n* 中国电信(chinanet)\n* 中国移动(cmcc)\n* 中国联通(unicom)\n* ~~中国铁通(tietong)~~\u003c即将废弃\u003e\n* 教育网(cernet)\n* 科技网(cstnet)\n* 鹏博士(drpeng) \u003c试验阶段\u003e\n* 谷歌中国(googlecn) \u003c试验阶段\u003e\n\n*P.S. 由于移动与铁通已合并，铁通集合即将废弃，详见[issue #10](https://github.com/gaoyifan/china-operator-ip/issues/10)。处于兼容性考虑，当前铁通的预生成数据同中国移动，未来将择机移除铁通。*\n\n*P.S. 鹏博士集团（包括：鹏博士数据、北京电信通、长城宽带、宽带通）的IP地址并非全都由独立的自治域做宣告，目前大部分地址仍由电信、联通、科技网代为宣告。故[列表](https://github.com/gaoyifan/china-operator-ip/blob/ip-lists/drpeng.txt)中的地址仅为鹏博士拥有的部分IP地址，且这些IP同时具有电信、联通两个上级出口。详见[issue #2](https://github.com/gaoyifan/china-operator-ip/issues/2).*\n\n*P.S. 如果需要国内所有地址的集合，请参考 [chnroutes2](https://github.com/misakaio/chnroutes2) 项目*\n\n## 如何获取数据\n\n### 使用预生成结果\n\nIP列表（CIDR格式）保存在仓库的[ip-lists分支](https://gaoyifan.github.io/china-operator-ip/index.html)中，GitHub Actions每日自动更新。\n\n```sh\ngit clone -b ip-lists https://github.com/gaoyifan/china-operator-ip.git\n```\n\nP.S. [stat文件](https://github.com/gaoyifan/china-operator-ip/blob/ip-lists/stat)记录了各运营商的IP数量的统计信息。\n\n### 从BGP数据生成\n\n#### 安装依赖\n\n* [bgptools](https://github.com/gaoyifan/bgptools) (`cargo install bgptools `)\n* [bgpdump](https://bitbucket.org/ripencc/bgpdump-hg/wiki/Home) (`apt install bgpdump`)\n* [cidr-merger](https://github.com/zhanhb/cidr-merger) (`go get github.com/zhanhb/cidr-merger`)\n\n#### 生成IP列表\n\n```shell\n./generate.sh\n```\n\n#### 统计IP数量\n\n```shell\n./stat.sh\n```\n## 致谢\n\n* 感谢[boj](https://ring0.me)师兄提出的[设计建议](https://github.com/ustclug/discussions/issues/79#issuecomment-267958775)\n* 感谢[University of Oregon Route Views Archive Project](http://archive.routeviews.org)项目提供BGP数据源\n* 感谢[Travis CI](https://travis-ci.org)提供优秀的持续集成平台\n* 感谢[GitHub](https://github.com/features/actions)提供计算资源\n* 感谢[cidr-merger](https://github.com/zhanhb/cidr-merger)项目提供高效的IP地址合并工具\n* 感谢[bgpdump](https://bitbucket.org/ripencc/bgpdump/wiki/Home)项目提供rib数据的读取工具\n\n## 协议\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgaoyifan%2Fchina-operator-ip.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fgaoyifan%2Fchina-operator-ip?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaoyifan%2Fchina-operator-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaoyifan%2Fchina-operator-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaoyifan%2Fchina-operator-ip/lists"}