Comment 26 for bug 1163147

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1163147] Re: Pleaserun dnsmasq in such a way that it can also be used on the host —to look up the VMs' names

Quoting Thomas Hood (<email address hidden>):
> Hi Serge,
>
> I agree that it's still debatable what the default behavior should be.
> There are at least two behaviors which would be sane.
>
> 1. VMs have the same view of DNS as their host except that they can
> resolve names of VMs.
>
> 2. VMs have the same view of DNS as their host including being able to
> resolve names of VMs.
>
> AIUI, #1 is the current default behavior. The submitter seems to claim
> that #2 used to be the default behavior;

I don't think it used to be the default behavior, rather it was trivial
to make it the behavior by adding 192.168.122.1 as a secondary name
server.

> in any case the submitter
> requests that #2 be the default behavior in the future.

I don't think (as one of the libvirt packaging maintainers) I'd want it
to be the default behavior, but trivially configurable to do so.

FWIW I only ever ssh to vms, so I just use a .ssh/config section like

Host *.libvirt
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  ProxyCommand nc $(host $(echo %h | sed "s/\\\\.libvirt//g") 192.168.122.1 | tail -1 | awk '{print $NF}') %p

to do it for me, but I did use to use resolv.conf like sarnold does,
years ago. (The .ssh/config solution obviously doesn't work for web, for
instance.)

> Behavior #2 is obviously more convenient. Implementing it requires that
> the host send DNS queries to dnsmasq-libvirt. That may not be what
> maintainers are willing to configure as the default, but it's something
> that I think should at least be offered as an option.

If there is a simple way to do so (that is, without a (non-negligable)
delta against upstream that would be great. Ideally it could be done
trivially for any local dnsmasqs (libvirt's, lxc's, I'm guess there are
nova and juju involved for some people...)

It seems like there should be a simple config command to tell the
host dnsmasq that *.libvirt goes to 192.168.122.1 (and then ignore
such requests from 192.168.122.1), *.lxc goes to 10.0.3.1, etc.