Ask Your Question
0

LXC configuration

asked 2017-07-04 16:45:52 -0600

MaoTao gravatar image

I'm new to the LXC world and i'm facing an issue. I can't start an LXC container normally. Here is the error:

~ $ sudo lxc-start -d -n newcon -F

lxc-start: conf.c: instantiate_veth: 2729 failed to attach 'vethK6YJGI' to the bridge 'lxcbr0': Operation not permitted
lxc-start: conf.c: lxc_create_network: 3022 failed to create netdev
lxc-start: start.c: lxc_spawn: 1100 Failed to create the network.
lxc-start: start.c: __lxc_start: 1355 Failed to spawn container "newcon".
lxc-start: tools/lxc_start.c: main: 366 The container failed to start.
lxc-start: tools/lxc_start.c: main: 370 Additional information can be obtained by setting the --logfile and --logpriority options.

veth and lxcbr0 are supposed to created automatically by LXC

~ $ cat /etc/lxc/default.conf 
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx

I can't figure out what causing the

Operation not permitted

I have come up wiht a temporary solution to my problem found by accident in an old article here: http://www.techrepublic.com/blog/linu...

~ # brctl addbr lxcbr0
~ # brctl setfd lxcbr0 0
~ # ifconfig lxcbr0 192.168.1.4 promisc up
~ # brctl addif lxcbr0 enp2s0
~ # route add -net default gw 192.168.1.1 lxcbr0

Could someone help with this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-07-04 23:26:02 -0600

aeperezt gravatar image

You need to change the file /etc/lxc/default.conf and set lxc.network.link = virbr0 instead of lxcbr0. You also need to change that on the containers that have already been created in your case /var/lib/lxc/newcon/config after that it will work. Please verify you have installed libvirt and started it systemctl start libvirtd more information look at here

Good Luck

edit flag offensive delete link more

Comments

Thanks a lot. Works perfect. Much better than have to manually create lxcbr0 each time.

MaoTao gravatar imageMaoTao ( 2017-07-05 02:15:07 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-07-04 16:45:52 -0600

Seen: 282 times

Last updated: Jul 04 '17