ipv6 domain name resolution unreliable due to too many resolv.conf entries
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
### Description
When using the default template name resolution for ipv6 only addresses works, but fails when using the docker template.
```
limactl start --vm-type=vz --network=vzNAT --set '.hostResolver.ipv6=true'
limactl shell default
---
lima@lima-default:/Users/admin$ curl --ipv6 www.google.com
# works (sometimes only on the second try)
lima@lima-default:/Users/admin$ curl api6.ipify.org
# works (sometimes only on the second try)
```
```
limactl start --vm-type=vz --network=vzNAT --set '.hostResolver.ipv6=true' template://docker
limactl shell docker
---
lima@lima-docker:/Users/admin$ curl --ipv6 www.google.com
curl: (6) Could not resolve host: www.google.com
lima@lima-docker:/Users/admin$ curl api6.ipify.org
curl: (6) Could not resolve host: api6.ipify.org
```
I sometimes observed the calls first failing in the default vm, but succeeding on the second try. When using a new address they fail again on the first try, but work on the second. For the docker vm they always fail.
I also tried disabling the hostResolver and using the Cloudflare DNS:
```
limactl start --vm-type=vz --network=vzNAT --set '.hostResolver.enabled=false | .dns=["1.1.1.1", "2606:4700:4700::1111", "1.0.0.1","2606:4700:4700::1001"]' template://docker
# works for some machines, and after recreating sometimes does not work at all
```
This works the default template. For the docker template it sometimes works, and after deleting the vm and recreating it does not.
ipv4 name resolution works in all cases.
-----------------
**Edit**:
I did some more testing and noticed the entries in resolv.conf
For the default template with 4 Cloudflare DNS entries:
```
lima@lima-default:/Users/admin$ cat /run/systemd/resolve/resolv.conf
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# ...
nameserver 192.168.64.1
nameserver fe80::d011:e5ff:feea:bf64%3
nameserver 1.1.1.1
# Too many DNS servers configured, the following entries may be ignored.
nameserver 1.0.0.1
nameserver 2606:4700:4700::1111
nameserver 2606:4700:4700::1001
nameserver 192.168.5.2
search .
```
And for the docker template with 4 Cloudflare DNS entries:
```
lima@lima-docker:/Users/admin$ cat /run/systemd/resolve/resolv.conf
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# ...
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 2606:4700:4700::1111
# Too many DNS servers configured, the following entries may be ignored.
nameserver 2606:4700:4700::1001
nameserver 192.168.5.2
nameserver 192.168.64.1
nameserver fe80::d011:e5ff:feea:bf64%3
search fritz.box
```
So the actual issue might be too many DNS entries in resolv.conf, the order does not seem to be fixed.
**When I manually delete the entries but 2 cloudflare servers it works after running `sudo netplan apply
`**
Is there a way to not include the other servers, only the ones specified?
**System**
macOS 15.5, MBP M3
lima 1.1.1 installed with homebrew
My internet connection has a ipv4 and ipv6, and my machine has a ipv4 and ipv6 assigned. Ipv6 tests like [this one](https://test-ipv6.com/) work for me
Contributor guide
Assessment
This issue has not been assessed yet.