I am running the latest Ubuntu (16.10) with LXD containers. Containers are configured with bridged networking, and they receive their own IP addresses from the DHCP server. I have configured them with the following:
lxc profile device add default eth0 nic nictype=bridged parent=br0
lxc network attach br0
Now, I need to set hardware addresses (MAC) manually for each of the containers, so their corresponding static IPs never change. However, I am having a hard time of doing so with lxc. Do I just set them in the corresponding /etc/network/interfaces, or is there a better (lxd/lxc) way of doing it?
Each container will keep the same MAC address as it was at first launch time. To get its value:
lxc config show container_name
or, more precise
lxc config get container_name volatile.NIC_NAME.hwaddr
This is not like in case of pure lxc when you had to manually set it in /var/lib/lxc/container_name/config.
But, if you really need to use your own set of MAC addresses(assuming eth0 is nic for container):
lxc config set container_name volatile.eth0.hwaddr yo:ur:ma:ca:dd:ress
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With