Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Aug 2024 16:38:04 -0700
From:      Alex Arslan <ararslan@comcast.net>
To:        "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net>
Cc:        Bakul Shah <bakul@iitbombay.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Diagnosing virtual machine network issues
Message-ID:  <08AA87E3-D631-4EA1-AA30-37B4709630CB@comcast.net>
In-Reply-To: <202408141829.47EITc7B080532@gndrsh.dnsmgr.net>
References:  <202408141829.47EITc7B080532@gndrsh.dnsmgr.net>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

> On Aug 14, 2024, at 11:29 AM, Rodney W. Grimes <freebsd-rwg@gndrsh.dnsmgr.net> wrote:
> 
>>> 
>>> On Aug 13, 2024, at 9:15?AM, Bakul Shah <bakul@iitbombay.org> wrote:
>>> 
>>> This weird 127. address seems like a systemd feature/bug thing: https://unix.stackexchange.com/questions/612416/why-does-etc-resolv-conf-point-at-127-0-0-53
>>> 
>>> This behavior seems like some strange interaction between systemd assumptions and freebsd?s, or something not being set up quite right on the linux side when the vm is running freebsd. 
>> 
>> Could libvirt be a factor here, do you think? For example, perhaps the
>> network should be configured differently than the default when the host
>> is using systemd-resolved and/or when the guest is FreeBSD. In the network
>> XML format for libvirt (https://libvirt.org/formatnetwork.html), there is
>> a `domain` element with a `localOnly` attribute that I have seen set by
>> some virtualization projects. As far as I can tell, our setup isn't using
>> the `domain` element at all.
> 
> Having a /etc/resolv.conf entry of 127.0.0.53 is indeed something
> out of the normal on a freebsd box.  You need to find where that
> is coming from and why that value is used.

The 127.0.0.53 entry in /etc/resolv.conf is on the Linux host machine,
not on the FreeBSD VM. The host is using `systemd-resolved` for managing
its /etc/resolv.conf. In the VM, /etc/resolv.conf has the host IP by
default, and we added 8.8.8.8 so that it wouldn't take a full 30 seconds
to report a domain resolution failure.

>> 
>>> 
>>>> On Aug 13, 2024, at 8:46 AM, Alex Arslan <ararslan@comcast.net> wrote:
>>>> 
>>>> ?
>>>> Hi Rodney,
>>>> 
>>>>> On Aug 10, 2024, at 9:11?AM, Rodney W. Grimes <freebsd-rwg@gndrsh.dnsmgr.net> wrote:
>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Aug 2, 2024, at 5:58?PM, Bakul Shah <bakul@iitbombay.org> wrote:
>>>>>>> 
>>>>>>> On Aug 2, 2024, at 3:52?PM, Alex Arslan <ararslan@comcast.net> wrote:
>>>>>>>> 
>>>>>>>>> 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.
>>>>>>> 
>>>>>>> What does your host use as a namesever?
>>>>>> 
>>>>>> The nameserver is 127.0.0.53. It sets options edns0 and trust-ad, and
>>>>>> includes a search entry as well.
>>>>> 
>>>>> First, is that a typo and you mean 127.0.0.1:53?
>>>> 
>>>> No, the host's /etc/resolv.conf has `nameserver 127.0.0.53`, I just went
>>>> back and rechecked to be sure.
>>>> 
>>>>> Second, is that name server locked to 127.0.0.1, or is it
>>>>> actually listinging on *:53?  If it is LOCKED you have no name server
>>>>> running on 192.168.122.1 to be reached by the VM, if it is NOT locked
>>>>> can the guest ping 192.168.122.1, and can it reach dns at that IP on
>>>>> port 53?   Can the host send a packet BACK to the guest?
>>>> 
>>>> I apologize but I don't really know enough about these things to know how
>>>> to answer your question. I did post the output of tcpdump on the VM and
>>>> the host a while back but that was for the invalid request, so that
>>>> probably doesn't capture what you're describing.
>>>> 
>>>>> Third you can "fix" the "nameserver 192.168.122.1" entry in /etc/resolv.conf
>>>>> by configuring the DHCP server that handed out the lease to the VM to send
>>>>> a namserver entry of 8.8.8.8.
>>>> 
>>>> If I understand correctly, that is indeed what we've done as a Band-Aid fix
>>>> for the time being: I added the line `prepend_nameservers=8.8.8.8` to
>>>> /etc/resolvconf.conf.
>>>> 
>>>>>> 
>>>>>>> 
>>>>>>>> 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?
>>>>>>> 
>>>>>>> You should diagnose the problem of the nameserver at 192.168.122.1
>>>>>>> and fix it to act properly. I don't use vm (just bhyve) so can't help
>>>>>>> you with its config.
>>>>>> 
>>>>>> I do still plan to try to figure out what the actual issue is, but I also
>>>>>> now have a path forward in the meantime. :)
>>>>>> 
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> Rod Grimes                                                 rgrimes@freebsd.org <mailto:rgrimes@freebsd.org><mailto:rgrimes@freebsd.org>
>> 
> 
> -- 
> Rod Grimes                                                 rgrimes@freebsd.org <mailto:rgrimes@freebsd.org>

[-- Attachment #2 --]
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br><div><blockquote type="cite"><div>On Aug 14, 2024, at 11:29 AM, Rodney W. Grimes &lt;freebsd-rwg@gndrsh.dnsmgr.net&gt; wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><blockquote type="cite"><br class="Apple-interchange-newline">On Aug 13, 2024, at 9:15?AM, Bakul Shah &lt;bakul@iitbombay.org&gt; wrote:<br><br>This weird 127. address seems like a systemd feature/bug thing: https://unix.stackexchange.com/questions/612416/why-does-etc-resolv-conf-point-at-127-0-0-53<br><br>This behavior seems like some strange interaction between systemd assumptions and freebsd?s, or something not being set up quite right on the linux side when the vm is running freebsd.<span class="Apple-converted-space">&nbsp;</span><br></blockquote><br>Could libvirt be a factor here, do you think? For example, perhaps the<br>network should be configured differently than the default when the host<br>is using systemd-resolved and/or when the guest is FreeBSD. In the network<br>XML format for libvirt (https://libvirt.org/formatnetwork.html), there is<br>a `domain` element with a `localOnly` attribute that I have seen set by<br>some virtualization projects. As far as I can tell, our setup isn't using<br>the `domain` element at all.<br></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Having a /etc/resolv.conf entry of 127.0.0.53 is indeed something</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">out of the normal on a freebsd box. &nbsp;You need to find where that</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">is coming from and why that value is used.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div></blockquote><div><br></div><div><div><div>The 127.0.0.53 entry in /etc/resolv.conf is on the Linux host machine,</div><div>not on the FreeBSD VM. The host is using `systemd-resolved` for managing</div><div>its /etc/resolv.conf. In the VM, /etc/resolv.conf has the host IP by</div><div>default, and we added 8.8.8.8 so that it wouldn't take a full 30 seconds</div><div>to report a domain resolution failure.</div></div><div><br></div></div><blockquote type="cite"><div><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br><blockquote type="cite"><br><blockquote type="cite">On Aug 13, 2024, at 8:46 AM, Alex Arslan &lt;ararslan@comcast.net&gt; wrote:<br><br>?<br>Hi Rodney,<br><br><blockquote type="cite">On Aug 10, 2024, at 9:11?AM, Rodney W. Grimes &lt;freebsd-rwg@gndrsh.dnsmgr.net&gt; wrote:<br><br><blockquote type="cite"><br><br><blockquote type="cite">On Aug 2, 2024, at 5:58?PM, Bakul Shah &lt;bakul@iitbombay.org&gt; wrote:<br><br>On Aug 2, 2024, at 3:52?PM, Alex Arslan &lt;ararslan@comcast.net&gt; wrote:<br><blockquote type="cite"><br><blockquote type="cite">Just a comment and a name server line:<br><br>$ cat /etc/resolv.conf<br># Generated by resolvconf<br>nameserver 192.168.122.1<br></blockquote><br>I believe that is the host IP, so I guess the VM is using the host for DNS<br>resolution? Interestingly, if I add `nameserver 8.8.8.8` below the line<br>with the host IP, it takes 10 seconds rather than 30 to reach the expected<br>domain resolution failure. If I put 8.8.8.8 above the host IP, the domain<br>resolution failure is instantaneous.<br></blockquote><br>What does your host use as a namesever?<br></blockquote><br>The nameserver is 127.0.0.53. It sets options edns0 and trust-ad, and<br>includes a search entry as well.<br></blockquote><br>First, is that a typo and you mean 127.0.0.1:53?<br></blockquote><br>No, the host's /etc/resolv.conf has `nameserver 127.0.0.53`, I just went<br>back and rechecked to be sure.<br><br><blockquote type="cite">Second, is that name server locked to 127.0.0.1, or is it<br>actually listinging on *:53? &nbsp;If it is LOCKED you have no name server<br>running on 192.168.122.1 to be reached by the VM, if it is NOT locked<br>can the guest ping 192.168.122.1, and can it reach dns at that IP on<br>port 53? &nbsp;&nbsp;Can the host send a packet BACK to the guest?<br></blockquote><br>I apologize but I don't really know enough about these things to know how<br>to answer your question. I did post the output of tcpdump on the VM and<br>the host a while back but that was for the invalid request, so that<br>probably doesn't capture what you're describing.<br><br><blockquote type="cite">Third you can "fix" the "nameserver 192.168.122.1" entry in /etc/resolv.conf<br>by configuring the DHCP server that handed out the lease to the VM to send<br>a namserver entry of 8.8.8.8.<br></blockquote><br>If I understand correctly, that is indeed what we've done as a Band-Aid fix<br>for the time being: I added the line `prepend_nameservers=8.8.8.8` to<br>/etc/resolvconf.conf.<br><br><blockquote type="cite"><blockquote type="cite"><br><blockquote type="cite"><br><blockquote type="cite">Not a particularly satisfying conclusion to this saga as I don't understand<br>why it's happening but at least I have a workaround that should hopefully<br>do the job. I really appreciate everyone's help and input thus far!<br><br>What's the best way to add `nameserver 8.8.8.8` to /etc/resolv.conf as<br>part of the VM's configuration?<br></blockquote><br>You should diagnose the problem of the nameserver at 192.168.122.1<br>and fix it to act properly. I don't use vm (just bhyve) so can't help<br>you with its config.<br></blockquote><br>I do still plan to try to figure out what the actual issue is, but I also<br>now have a path forward in the meantime. :)<br><br><br></blockquote><br>--<span class="Apple-converted-space">&nbsp;</span><br>Rod Grimes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:rgrimes@freebsd.org">rgrimes@freebsd.org</a>&lt;<a href="mailto:rgrimes@freebsd.org">mailto:rgrimes@freebsd.org</a>&gt;<br></blockquote></blockquote></blockquote><br></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">--<span class="Apple-converted-space">&nbsp;</span></span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Rod Grimes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a href="mailto:rgrimes@freebsd.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">rgrimes@freebsd.org</a></div></blockquote></div><br></body></html>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?08AA87E3-D631-4EA1-AA30-37B4709630CB>