![如何防止Docker导致我的.local地址解析为172.29.0.1?](https://linux22.com/image/955209/%E5%A6%82%E4%BD%95%E9%98%B2%E6%AD%A2Docker%E5%AF%BC%E8%87%B4%E6%88%91%E7%9A%84.local%E5%9C%B0%E5%9D%80%E8%A7%A3%E6%9E%90%E4%B8%BA172.29.0.1%EF%BC%9F.png)
我有一台最近安装的机器(称为vader
),在我的 Pi-hole 上有一个自定义 DNS 条目。当我尝试解析时,这有效vader.home
:
$ resolvectl query vader.home
vader.home: 192.168.1.212 -- link: wlp12s0
-- Information acquired via protocol DNS in 6.1ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
-- Data from: network
但是,我的多播 DNS 查找返回了几个地址:
$ resolvectl query vader.local
vader.local: 192.168.1.212 -- link: wlp12s0
172.17.0.1 -- link: docker0
172.29.0.1 -- link: br-462118ed237e
fe80::9666:a33c:1c7a:2b29%3 -- link: wlp12s0
fe80::42:2ff:feee:99f5%243 -- link: br-462118ed237e
fe80::50db:73ff:fe4d:ee9%297 -- link: veth329abca
...并且“错误”的那个正在被如下实用程序使用ping
:
$ ping vader.local
PING vader.local (172.29.0.1) 56(84) bytes of data.
64 bytes from vader (172.29.0.1): icmp_seq=1 ttl=64 time=0.018 ms
64 bytes from vader (172.29.0.1): icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from vader (172.29.0.1): icmp_seq=3 ttl=64 time=0.040 ms
64 bytes from vader (172.29.0.1): icmp_seq=4 ttl=64 time=0.038 ms
我本来希望ping
使用192.168.1.212
。
请注意,172.17.0.1
和172.29.0.1
都是由 Docker 创建的(一个是桥梁):
$ ip address | grep 172
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
inet 172.29.0.1/16 brd 172.29.255.255 scope global br-462118ed237e
我找不到明确的配置导致这种情况发生。有人知道如何撤消它吗?