[systemd-devel] automatic name resolution of nspawn-machines
lennart at poettering.net
Tue Mar 3 09:12:17 PST 2015
On Tue, 03.03.15 14:24, killermoehre (killermoehre at gmx.net) wrote:
> I'm running systemd-219 on arch linux. The setup is as follows:
> - Host (laptop in changing networks) with multiple NICs
> - unbound as caching DNS proxy on the host listening on any interface
> - NetworkManager for wireless control
> - several nspawn-machines using the default systemd-nspawn.service which
> configure their net by itself (/28) via systemd-networkd.
> In the nspawn-container I added a perl-one-liner as service to set the
> default gateway as DNS-server, where unbound is listening (which would
> be a nice default feature for networkd, too):
resolved gets DHCP DNS server info from networkd anyway, and uses
it. No need to rewrite anything.
> My goal now: I want that the host can talk to the machines and vice
> versa via simple hostnames, so if my nspawn-machine is called "web" and
> the machines hostname is "web", too, than http://web/ should talk to the
> webserver in this machine. web.local via mdns would be fine, too.
If nss-mymachines is part of your NSS setup, then all locally running
containers are resolvable automatically from the host. See the
nss-mymachines(8) man page for details how to configure that.
To make sure the containers can resolve the host, make sure to enable
resolved on both the host and in each container, and that "resolve" is
in the NSS configuration line of each. Their hostnames should then be
resolvable automatically, due to the wonders of LLMNR. No further
This will only give you host name resolution between host and
containers and vice versa. To get host name resolution to work between
multiple containers simply place them on the same bridge, so that they
become a single broadcast domain, so that LLMNR then does the right
Lennart Poettering, Red Hat
More information about the systemd-devel