Hi,
I think this instructions will work to you in order to have a bridge mode with lxd:
In the host:
$ sudo apt-get update
$ sudo apt-get install bridge-utils
Create and configure the bridge:
$ sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
#auto enp0s3 <----------------- enp0s3 is the real NIC in my computer
#iface enp0s3 inet static
auto br0 <----------------- br0 is the name I use for the bridge interface
iface br0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
bridge_ports enp0s3 <----------- the real NIC is connect to the bridge
bridge_stp off
bridge_fd 0
bridge_maxwait 0
$ sudo reboot
Now, the host has a new interface br0 working like a switch (where the containers will be able to connect it and work like a real computer in your lan)
Now, you have to create a new profile:
$ lxc profile copy default bridge
$ lxc profile edit bridge
config: {}
description: bridge profile
devices:
eth0:
nictype: bridged
parent: **br0** <---- replace lxdbr0 with br0 in order to use the 'switch' br0
type: nic
root:
path: /
pool: lxd
type: disk
name: default
used_by: []
Lastly, you must use the new profile:
$ lxc launch ubuntu:x c1 -p bridge <-- to create a new container in bridge mode
$ lxc profile assign c1 bridge <-- to assign the profile to a existing container
The container must be correctly configurated with IP, MS, gateway and DNS to work in your lan. If it’s all correct, the container will be another computer in your lan.
If your host is a virtual machine in Virtualbox, you have to configure the network adapter in Virtualhost as bridge mode and Promiscuous mode - Allow all.
MACVLAN:
In the host, you don’t have to do anything in the network config but you have to create a new profile:
$ lxc profile copy default macvlan
$ lxc edit macvlan
description: macvlan profile
devices:
eth0:
nictype: **macvlan** <--- replace bridged with macvlan
parent: enp0s3
type: nic
root:
path: /
pool: lxd
type: disk
name: macvlan
used_by: []
Now the same as before, you must use the new profile:
$ lxc launch ubuntu:x c1 -p macvlan <-- to create a new container in macvlan mode
$ lxc profile assign c1 macvlan <-- to assign the profile to a existing container
The container must be correctly configurated with IP, MS, gateway and DNS to work in your lan. If it’s all correct, the container will be another computer in your lan; nevertheless, container and host will not be able to talk among them.
Mode macvlan did not work for me in Virtualbox (I tried it a few months ago).
I suppose that you are not working with wifi. If you are working with wifi, neither the bridge nor the macvlan, will work.
Salutes