Just ran init and LCX or LXD doesn't do what I told it


(Mattias Hedman) #1

I just ran lxd init and I told lxd that:
Would you like LXD to be available over the network (yes/no): YES!
Do you want to configure the LXD bridge (yes/no) [default=yes]? NO!

And I told it that br0 is a bridge I have created.

Everything seems fine but when I run lxc list:
The network says (eth0), that is not the IP of the bridge not even close.

Whats up?

(Stéphane Graber) #2

What does lxc profile show default show you?

(Mattias Hedman) #3

config: {}
description: Default LXD profile
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
path: /
pool: lxdstorage
type: disk
name: default

  • /1.0/containers/web-server

And the container can be pinged from the network and can ping the local network but not outside the LAN.
And apt doesn’t work since it doesn’t have a internet connection.

(Stéphane Graber) #4

Hmm, that’s odd and that lxd init ran to the end and without an error at the end?
Can you also show lxc config show and ps aux | grep lxd?

(Mattias Hedman) #5

Atm no, I have uninstalled everything to start from the beginning so we will see.

(Stéphane Graber) #6

Ok, if using the snap, make sure you don’t have the deb installed (lxd and lxd-client packages) at the same time as it could lead to what you described.

(Mattias Hedman) #7

So I had to reinstall the server completely (or so I thought) so here I am with an clean install of everything.
I did ran lxd init found a post about networking wih lxc/lxd that looked good:

I havn’t made any changes yet since I dont have /etc/lxc or /etc/default/lxc.

All I have installed concerning this is bridge-utils. I have set up an br0.
I have one container as of now it has an erh0 network that is uniqe to that on, it can ping all the machine on the lan but no one on the lan can reach the container.

So I am running the lxc/lxd install that comes with Ubuntu Server 18.04 LTS.
So now what?

(Stéphane Graber) #8

Can you show the entire output of your lxd init run on Ubuntu 18.04, ideally including the yaml output it offers to generate at the end?

(Mattias Hedman) #9

I ran the init with default settings - and where do I find the file you want?

(Stéphane Graber) #10

It would have been an option at the end of the lxd init run.

Anyway, since you used the defaults, it’s normal that all your containers are bridged to a private bridge, that’s what the defaults do.

To undo that and use your br0 bridge instead, you can do something like:

  • lxc network delete lxdbr0
  • lxc profile device set default eth0 parent br0

(Mattias Hedman) #11

I cant since the network is in use - now I am asking to simple questions it feels like.
The lxdbr0 network is set to down.
I tried to stop the container - that didnt help.

(Stéphane Graber) #12

Ok, only run the second command then, then restart your containers, once they’re all on the br0 network, you should be able to delete lxdbr0.

(Mattias Hedman) #13

True, first 2 then 1 worked just fine.
Exciting the container just got an DHCP IP.

Is there a way to tell lxc to make this as default?

(Stéphane Graber) #14

Those commands changed the default profile, so all new containers will have this.

(Mattias Hedman) #15

Thank you!
All is working now!