File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,6 +251,12 @@ RFC 3484 的排序包含两者:源地址选择(source address selection)
251251precedence ::ffff:0:0/96 100
252252```
253253
254+ !!! tip "如果不希望 glibc 发送 AAAA 请求……"
255+
256+ glibc 的 `getaddrinfo()` 在参数为 `AF_UNSPEC` 时,总是会同时发送 A 和 AAAA 请求(即使设置了 `net.ipv6.conf.all.disable_ipv6`)。同样,上面的 `gai.conf` 配置也无法阻止 glibc 发送 AAAA 请求(只是在获取到两者之后优先选择 IPv4)。
257+
258+ 在 glibc 2.36 之后,glibc 提供了 `no-aaaa` 选项,可以在 `resolv.conf` 中添加。而对更老版本的机器,则可能需要考虑使用 [nss-dns4only](https://github.com/ossobv/nss-dns4only) 这种第三方的 NSS 模块来实现。
259+
254260##### resolv.conf {#resolv-conf-glibc}
255261
256262glibc 在实际发 DNS 请求前会读取 [ ` /etc/resolv.conf ` ] [ resolv.conf.5 ] 。其最多支持 [ MAXNS] ( https://elixir.bootlin.com/glibc/glibc-2.42.9000/source/resolv/bits/types/res_state.h#L8 ) (默认为 3)个 ` nameserver ` 配置。如果配置了多个 ` nameserver ` ,那么 glibc 会依次尝试这些服务器。
You can’t perform that action at this time.
0 commit comments