4

I am experimenting with LXD, but I'm stuck with a seamingly simple problem: I can't make my bridge config persistent.

The host server has a birdge br0. By default, lxd managed containers will use lxcbr0 and be on another network.

What I want is a container that will get its IP from my main DHCP server, and share the same network as the rest of my servers.

I managed to do so using this stanza:

lxc config set mycontainer raw.lxc 'lxc.network.link = br0'

This seems to work, but every now and then, the configuration gets lost, and the container falls back onto lxcbr0 !

  • So, is this the right way to get my container to use br0 ?
  • And what is the way to make this persistent for real ?
6

I solved this using a profile.

lxc config profile edit bridge

Then in the editor:

name: bridge
config: {}
devices:
    eth0:
        nictype: bridged
        parent: br0
        type: nic

And when creating a guest/container, specify the profile

lxc launch ubuntu GUESTNAME -p bridge

Not sure, but assume you can apply the profile to existing guests/containers as well. Have not tried it.

EDIT:
From lxd 0.18 profile is part of main commands:

lxc profile edit bridge

  • 2
    thanks for the tip, this seems to be what I was looking for. Notice the syntax has evolved a bit (LXD 0.18) to 'lxc profile edit bridge' (no more config keyword). – alci Sep 23 '15 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.