Bonsoir les amis,
Voilà je suis entrain d’expérimenter depuis quelque temps la solution de containerisation native à systemd, systemd-nspawn, et j’ai donc crée un container qui me sert au quotidien comme serveur DNS, ainsi qu’un autre container dans lequel j’ai basardé skype.
Le problème se situe au niveau de la configuration des adresses IP respectives de ces containers en IP fixes. Jusqu’à présent les containers fonctionnaient avec une config DHCP, puis j’ai décidé de me pencher dessus et de mettre tout ça en IP fixe.
Mon pc est un portable, la connexion à la box se fait donc en wifi, et je n’ai pas configuré de bridge (délicat à configurer avec une connexion wifi). Les containers eux, que ce soit en DHCP ou IP fixe, sont connectés par l’intermédiaire d’interfaces ethernet virtuelles (–network-veth), dont une partie se trouve à l’extérieur du container, donc côté hôte, et l’autre partie se trouve dans le container. Jusque là pas de problème…
Le problème vient lorsque je place le tout en adresses IP fixes, alors seul le 1er container démarré a un ping vers la passerelle (ma box) et donc vers l’extérieur, en gros il capte la connexion pour lui tout seul et les autres containers ne sont pas capables de communiquer avec l’extérieur…
Donc en fait je ne sais pas trop s’il s’agit d’un bug inhérent à systemd-nspawn, ou bien d’un problème de configuration de ma part… (Ça ressemble au problème qui existe/existait avec les jails sous BSD et l’option “veth” pour ceux qui connaissent).
Exemple fichier config côté hôte :
gogi@blabla:~$ cat /etc/systemd/network/80*
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# This network file matches the host-side of the virtual Ethernet link
# created by systemd-nspawn's --network-veth switch. See systemd-nspawn(1) for
# details.
[Match]
Name=ve-bind9
Driver=veth
[Network]
# Default to using a /28 prefix, giving up to 13 addresses per container.
Address=192.168.1.101/24
#Gateway=192.168.0.254
#LinkLocalAddressing=yes
IPMasquerade=yes
LLDP=yes
EmitLLDP=customer-bridge
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# This network file matches the host-side of the virtual Ethernet link
# created by systemd-nspawn's --network-veth switch. See systemd-nspawn(1) for
# details.
Exemple fichier config côté container :
bind9@bind9:~$ cat /etc/systemd/network/80*
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# This network file matches the container-side of the virtual Ethernet link
# created by systemd-nspawn's --network-veth switch. See systemd-nspawn(1) for
# details.
[Match]
Virtualization=container
Name=host0
[Network]
Address=192.168.1.1/24
Gateway=192.168.1.101
LinkLocalAddressing=yes
LLDP=yes
EmitLLDP=customer-bridge
Ça commence à me taper sur le système sérieusement cette histoire, alors avant d’écrire à L. Poettering, je suis preneur de toute suggestion