afraid.org 的免费二级域名不会被 Google 收录的原理

米鸽
·
·
IPFS
为什么 freedns.afraid.org 的子域名不被搜索引擎收录?

用过 afraid.org 免费二级域名的可能会发现,获得的二级域名并不会被 Google 收录,就算你再开个三级的解析,也不能收录。

为什么呢?

freedns.afraid.org 的 FAQ freedns.afraid.org/f... 里有说明:

Subdomains created off of shared domains have some permissions restrictions. There are no permissions restrictions with Google that apply to domain owners themselves for hostnames they create to their own domains.

Users of shared domains may use freedns.afraid.org with Google too. freedns.afraid.org operates a separate set of DNS servers just for Google, which only Google can see.

The official workings are as follows:

1) At around 4AM PST each night, the previous 24 hours' worth of domain additions are made visible to Google. (subdomain edits and updates are instant).

2) No subdomains created via the shared domain system are visible to Google. You must own the domain itself that you are creating a subdomain off of to have it visible to Google by default.

NOTE: Older subdomains may in fact be visible to Google. To make it more evident of whether or not your site is visible to Google, a blue (G) will appear next to a record in the subdomains section as an indicator.

We at freedns.afraid.org do not wish to prohibit our members from publishing their own sites and content. If you wish to have your site seen by Google, and are not using a domain of your own, please contact [email protected] with a working URL to your website. Also, keep in mind it's important you choose a domain that is not likely to disappear when building your website on it. Any domains owned by freedns.afraid.org should be around forever, however domains not owned by freedns.afraid.org are not guaranteed.

Of course, domains that you own have none of the Google restrictions that this FAQ item is referring to.

这段 FAQ 的大意是:

  • 用别人提供的「共享域名」(shared domains)创建的子域名,在对接 Google 时有权限限制;但如果是你自己名下的域名,在这个域名下创建的主机名,和 Google 之间没有这种限制。

  • 使用共享域名的用户也可以配合 Google 使用 freedns.afraid.org为此,freedns.afraid.org 运行了一套只给 Google 使用、只有 Google 能看到的专用 DNS 服务器。

  • 一些早期创建的子域名可能仍然对 Google 可见。为了让你更直观地知道某条记录是否对 Google 可见,FreeDNS 在子域名列表中会用一个蓝色的 “G” 图标标示可见。

  • FreeDNS 不想阻止用户把自己的网站发布到 Google。如果你想让你的网站被 Google 收录,但你用的不是你自己的域名,可以发邮件到 [email protected],附上能访问的网站 URL,请求开放给 Google。

  • 若你使用的是自己注册并持有的域名,上述对 Google 的这些限制都不适用,你完全不受这些规则约束。

具体规则:

  1. 每天大约在太平洋时间凌晨 4 点,会把过去 24 小时内新加的「域名」同步给 Google(子域名的修改和更新是即时的)。

  2. 通过共享域名系统创建的子域名,默认对 Google 是不可见的。只有当你真正拥有这个顶级域名本身时,在其下面创建的子域名才会默认对 Google 可见。

那么,这种限制是怎么实现的呢……?

技术上实现这种「只给 Google 用的专用 DNS 服务器」,核心就是:单独做一套权威 DNS,只把它的地址/路由交给 Google,用 BGP/私网/ACL 控制其它人看不到,然后通过同步机制让这套 DNS 跟主权威 DNS 保持一致。

下面用运营者视角,结合了一些 GPT 推测的回答,给一个相对现实的设计思路(不是 FreeDNS 官方实现,只是合理推演方案):

整体思路

  • 公开权威 DNS 集群:对全网提供 NS 记录(普通用户用的那套)。

  • Google 专用权威 DNS 集群:仅对 Google 可见、可访问,用相同/特定区域数据,但有单独的「视图」,可以屏蔽共享域名等。

  • 区域数据同步:主数据库或主 DNS 产生区数据,专用集群以 AXFR/IXFR 或内部 API 同步。

只让 Google 看见的几种做法

1. Anycast+BGP 只对 Google 宣告

  • 准备一段单独的 Anycast IP 段,比如 203.0.113.0/24,里面若干 NS IP(ns-g1.afraid.org 等)。

  • 在全球 PoP 上,将这段前缀通过 BGP 只向 Google 的 ASN 做定向宣告,或放在只对 Google/合作运营商可见的私有对等/专线里,这样:

    • Google 的递归解析器会看到并访问这套 NS;

    • 公网上其它递归解析器根本路由不到这些 IP,自然「看不见」。

2. DNS ACL + 源地址过滤

在 Google 专用集群上启用访问控制:

  • DNS 服务只接受来自 Google Public DNS / Google 递归解析器 IP 段(如 8.8.8.8、8.8.4.4、8.34.208.0/20 等官方公布网段)的查询请求,其它源地址直接 REFUSED 或 DROP。

  • 外层再叠加防火墙 ACL,只允许这些 IP 段访问 53 端口。

即使有路由,非 Google 的客户端也访问不了专用 NS。

3. 利用「视图」(view)或双区

在这套 Google 专用 NS 上,为同一个域名维护不同「视图」或不同 zone:

  • zone A:包含所有你自己持有的域名及其子域(对 Google 可见)。

  • zone B:过滤掉通过共享域名系统创建的子域,或者只包含官方/用户自有域名。

例如用 BIND 的 views / PowerDNS 的 Lua / KnotDNS 的 ACL 分流:

  • 对来自 Google 的请求,返回 zone A/B 中「允许给 Google 看」的数据;

  • 不存在或禁止的共享域名,直接 NXDOMAIN,让 Google 当作不存在。

与主 DNS 的同步机制

要做到「每天 4AM PST 把前 24 小时新加的域名导出给 Google,子域更新即时」,可以这么设计:

  • 主数据库里给每条记录打「是否可见于 Google」字段(owner 域/共享域名状态决定)。

  • 每晚 4 点跑一次任务:

    • 扫描过去 24 小时新增且可见于 Google 的域,把它们导出为 zone 文件或通过 API 下发到 Google 专用 NS。

  • 子域修改、IP 变更之类,则走实时消息队列或 webhook,专用 NS 通过增量更新(IXFR 或内部 API)即时同步。

达到「只有 Google 能看到」的最终效果……

  • 在公共 DNS 体系中,域名的 NS 记录只指向公开 NS 集群;

  • Google 那一侧,额外配置了指向专用 NS 的解析路径(可以是内部配置、私有 Cloud DNS 转发/私有 zone 之类),这部分对普通互联网用户不可见。

  • 专用 NS IP 不对全网宣告/不接受全网访问,加上 DNS 级 ACL,保证「只有 Google 能查到」。

这样就可以实现 FAQ 里说的那种「只给 Google 使用、只有 Google 能看到的专用 DNS 服务器」,同时满足:

  • 正常用户通过公开 NS;

  • Google 有一条「特供视图」,可以屏蔽共享域名、只收录你希望它看到的内容。

CC BY-NC-ND 4.0 授权

喜欢我的作品吗?别忘了给予支持与赞赏,让我知道在创作的路上有你陪伴,一起延续这份热忱!