DNS caches slowest response
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.2k
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
I'm running Docker For Windows, and noticed I was getting some strange results for DNS queries. The windows host machine has multiple DNS servers specified...
- LAN
- WAN
- Google (8.8.8.8)
We have an internal hostname that returns different results depending on which DNS server responds. The LAN DNS server will respond with an IP address on that LAN. The WAN DNS server will respond with an IP address from that subnet.
Just after Docker has been (re)started, doing a dig for the hostname inside a container returns the correct LAN address (vpnkit is presumable just returning the first answer it received). However all subsequent lookups for that hostname always return the incorrect WAN IP address.
Running a Wireshark capture on the Windows host, I can see that vpnkit sends the query off to all configured DNS servers the first time the lookup is done inside the container. The LAN DNS server responds first, so that is what gets returned to the docker container. However, all subsequent lookups only get sent to the LAN DNS and 8.8.8.8. Even though the WAN DNS server is not being queried, and the correct LAN IP address is being received by the host, the container is receiving the WAN IP address as the answer. Therefore, it would appear that after the first query, vpnkit has cached the slowest response and will always return that to the container.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with Docker for Windows by running repeated dig queries for a hostname whose LAN and WAN DNS servers return different addresses. Use the described Wireshark capture to compare the first lookup with later lookups and investigate vpnkit's DNS cache. Done means subsequent container lookups consistently return the correct response rather than the slower WAN result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100