Hi Najib!
You can create a LXD profile with two entries about networking (macvlan, and bridged), then create a container using that profile.
Here is how to do that:
-
I suppose you already have a profile according to https://blog.simos.info/how-to-make-your-lxd-container-get-ip-addresses-from-your-lan/ Let’s call that profile
lanprofile
. -
Copy that profile into a new name, let’s say,
macbridge
(macvlan
andbridge
).lxc profile copy lanprofile macbridge
-
Add a new
eth1
network interface for thelxdbr0
bridge.lxc profile device add macbridge eth1 nic nictype=bridged parent=lxdbr0
-
By doing so, the
macbridge
profile will look like:devices: eth0: nictype: macvlan parent: enp3s0 type: nic eth1: nictype: bridged parent: lxdbr0 type: nic
-
And now you can launch the container with
lxc launch ubuntu:18.04 --profile macbridge mycontainer
When you get a shell in mycontainer
, you will notice that eth1
did not get an IP address automatically. It’s up to you to make the configuration to get the IP address automatically. The manual way, anyway, is sudo dhclient eth1
.