[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: systemd-nspawn networking inside VirtualBox VM



On 7/7/2020 3:13 PM, Didar Hossain wrote:
Hi,

TL;DR
How to get systemd-nspawn containers networking so that they can talk to each
other, the host and the internet inside a Buster VM? VirtualBox on Windows 10
which has internet connectivity via a wireless interface.



I am running a Buster VM with hand picked minimal packages, networking is
configured simply using interfaces(5) file with DHCP. I have configured a
"NatNetwork" on VirtualBox which allows the VMs to connect to each other and the
internet. I was wondering if I can do similar thing with containers inside the
buster VM.

I used `debbootstrap' to have a template directory of buster under
"/opt/templates/buster". I then simply copy the directory tree over to
"/var/lib/machines". I tried a few networking options of `systemd-nspawn', but
since I am not well educated about macvlan, ipvlan, I could not get the
networking working at all. I would like to avoid using
"systemd-networkd/systemd-resolvd" especially on the Buster host - using those
it seems should make everything work automagically.

If it works then I will be able to test my Dovecot/Exim setup easily in such
throwaway containers. I currently do testing using VMs.

Does anyone have experience in having this kind of scenario working?


For testing purposes, I use in a Buster VM systemd-container.
That is if your VM has internet access the containers will also get
internet access .

For sake of simplicity, I would strongly suggest you to use in the VM
systemd-networkd to get the networking working between the containers
and the VM.

$ debootstrap --include=systemd-container

You need the above debootstrap pkg for systemd-networkd to work in the
container.

Then in the VM and in eatch container, simply enable systemd-networkd.


If you realy want to do the networking yourself, you will need to create
the bridge based on the examples found in '/lib/systemd/network'.

--
John Doe


Reply to: