Re: Diagnosing virtual machine network issues

From: Alex Arslan <ararslan_at_comcast.net>
Date: Fri, 02 Aug 2024 22:52:55 UTC

> On Jul 30, 2024, at 2:53 PM, Alex Arslan <ararslan@comcast.net> wrote:
> 
> 
>> On Jul 30, 2024, at 2:22 PM, Bakul Shah <bakul@iitbombay.org> wrote:
>> 
>>> On Jul 30, 2024, at 2:11 PM, Alex Arslan <ararslan@comcast.net> wrote:
>>> 
>>>> Can you provide more context?  I'm not seeing earlier messages anywhere in my email folders.  Is this a Qemu issue?
>>> 
>>> The original message is from just over a month ago, archived here:
>>> https://lists.freebsd.org/archives/freebsd-hackers/2024-June/003378.html
>>> Basically, we have FreeBSD 13.2 VMs running under KVM on a Linux machine.
>>> Some code is using libcurl to make a request to an invalid domain and is
>>> testing that the error is a resolution failure. This test passes on all
>>> platforms except specifically in these FreeBSD VMs; I can't reproduce
>>> locally on FreeBSD. That made me think that there's an issue with how the
>>> VM was set up, prompting the original message and discussion. Then what
>>> I recently found was that we set a 30-second timeout for the libcurl
>>> request, which FreeBSD hits in the VM, as it evidently spends a full
>>> 30 seconds attempting to resolve the host, while e.g. Linux reports a
>>> resolution failure immediately.
>> 
>> What does /etc/resolv.conf look like on the FreeBSD VM?
> 
> 
> Just a comment and a name server line:
> 
> $ cat /etc/resolv.conf
> # Generated by resolvconf
> nameserver 192.168.122.1

I believe that is the host IP, so I guess the VM is using the host for DNS
resolution? Interestingly, if I add `nameserver 8.8.8.8` below the line
with the host IP, it takes 10 seconds rather than 30 to reach the expected
domain resolution failure. If I put 8.8.8.8 above the host IP, the domain
resolution failure is instantaneous.

Not a particularly satisfying conclusion to this saga as I don't understand
why it's happening but at least I have a workaround that should hopefully
do the job. I really appreciate everyone's help and input thus far!

What's the best way to add `nameserver 8.8.8.8` to /etc/resolv.conf as
part of the VM's configuration?