[systemd-devel] automatic name resolution of nspawn-machines
killermoehre
killermoehre at gmx.net
Tue Mar 3 05:24:03 PST 2015
Hi,
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):
--- /etc/systemd/system/set-gateway-as-dns.service (line broken) ---
[Unit]
Description=Set the default gateway as DNS server
Requires=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=-/usr/bin/mkdir -p /run/systemd/resolved.conf.d
ExecStart=/usr/bin/perl -e 'open(my $fh, ">",
"/run/systemd/resolved.conf.d/99-gateway.conf");
print { $fh } "[Resolve]\nDNS=" . join("", qx(/usr/bin/networkctl
--no-pager --no-legend status host0) =~ /Gateway:
(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) . "\n";
close($fh);'
ExecStart=/usr/bin/systemctl restart systemd-resolved
[Install]
WantedBy=multi-user.target
--- End Of File ---
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.
Any advice?
Regards
Silvio Knizek
--
Xfce4.12 is out! Wait until your distributor packaged it for you!
Questions regarding xfce? Meet me at irc://irc.freenode.net/xfce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150303/2c4a6fb1/attachment.sig>
More information about the systemd-devel
mailing list