Restart from scratch lxc (uninstall and reinstall lxc) or can you return to default configuration?
Regards!!!
Restart from scratch lxc (uninstall and reinstall lxc) or can you return to default configuration?
Regards!!!
You should be able to just undo any change you made to /etc/default/lxc-net and then restart the lxc-bridge
service.
Would also help a bit if you could tell us more about what the problem is.
Hello @stgraber thank you very much for your answer
Since I created my first container I have not had access to the internet.
I have used several configurations that I found online but I have not found the right one for my case
That’s why I decided to start from an installation of lxc as recently installed.
I was able to create a bridge to configure the containers but I could not configure it correctly to have connectivity with the internet
It is the first time that I use bridge for a configuration of virtualization in linux and I assume that it is my biggest problem at the moment
I have the doubt that a video that I found https://youtu.be/4TzMl6mkqWU?t=5m47s is shown after installing lxc starts a container, that container at once has no ip but then gives an ip and can be ping
What files should I show the content to see if my settings are correct? both in the lxc Debian 9 server and in the container
Regards!!
The following files would be useful:
/etc/default/lxc
# LXC_AUTO - whether or not to start containers at boot
LXC_AUTO="true"
# BOOTGROUPS - What groups should start on bootup?
# Comma separated list of groups.
# Leading comma, trailing comma or embedded double
# comma indicates when the NULL group should be run.
# Example (default): boot the onboot group first then the NULL group
BOOTGROUPS="onboot,"
# SHUTDOWNDELAY - Wait time for a container to shut down.
# Container shutdown can result in lengthy system
# shutdown times. Even 5 seconds per container can be
# too long.
SHUTDOWNDELAY=5
# OPTIONS can be used for anything else.
# If you want to boot everything then
# options can be "-a" or "-a -A".
OPTIONS=
# STOPOPTS are stop options. The can be used for anything else to stop.
# If you want to kill containers fast, use -k
STOPOPTS="-a -A -s"
USE_LXC_BRIDGE="false" # overridden in lxc-net
[ ! -f /etc/default/lxc-net ] || . /etc/default/lxc-net
/etc/default/lxc-net
USE_LXC_BRIDGE="true"
LXC_BRIDGE="bt0"
LXC_ADDR="192.168.3.10"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="192.168.3.0/24"
LXC_DHCP_RANGE="192.168.3.2,10.0.3.254"
LXC_DHCP_MAX="253"
LXC_DHCP_CONFILE=""
LXC_DOMAIN=""
/etc/lxc/default.conf
lxc.network.type = empty
/var/lib/lxc/d9lxc/config
# Template used to create this container: /usr/share/lxc/templates/lxc-debian
# Parameters passed to the template: -r stretch
# Template script checksum (SHA-1): 127e2020d76da79709d5e4e0c7e347f40a6a793b
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
lxc.network.type = empty
lxc.rootfs = /var/lib/lxc/d9lxc/rootfs
lxc.rootfs.backend = dir
# Common configuration
lxc.include = /usr/share/lxc/config/debian.common.conf
# Container specific configuration
lxc.tty = 4
lxc.utsname = d9lxc
lxc.arch = amd64
Ok, so your /etc/lxc/default.conf is the issue, which cause the same problem to be replicated in your container’s config.
I suspect you want both /etc/lxc/default.conf and /var/lib/lxc/d9lxc/config changed, replacing:
lxc.network.type = empty
with:
lxc.network.type = veth
lxc.network.link = bt0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
Which will have your existing container and any new ones get connected to your bt0
bridge rather than be provisioned with no network interfaces.
I tried to start the container but it shows me the following:
~# lxc-start -n d9lxc
lxc-start: tools/lxc_start.c: main: 366 The container failed to start.
lxc-start: tools/lxc_start.c: main: 368 To get more details, run the container in foreground mode.
lxc-start: tools/lxc_start.c: main: 370 Additional information can be obtained by setting the --logfile and --logpriority options.
~# lxc-start -n d9lxc -F
lxc-start: conf.c: instantiate_veth: 2669 failed to attach 'vethRCGOWL' to the bridge 'bt0': Operation not permitted
lxc-start: conf.c: lxc_create_network: 2962 failed to create netdev
lxc-start: start.c: lxc_spawn: 1088 Failed to create the network. lxc-start: start.c: __lxc_start: 1346 Failed to spawn container "d9lxc". 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.
these are my network configurations on my lxc Debian 9 server:
/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo bt0
iface lo inet loopback
# Configurar interfaces manualmente, evitando conflictos con, por ejemplo, el administrador de red
iface bt0 inet manual
# Configuración del puente
iface bt0 inet static
bridge_ports enp3s0
address 192.168.0.200
broadcast 192.168.0.255
netmask 255.255.255.0
gateway 192.168.0.90
dns-nameservers 8.8.8.8 8.8.4.4
~# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 74:d4:35:5e:e0:7a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.223/24 brd 192.168.0.255 scope global dynamic enp3s0
valid_lft 5976sec preferred_lft 5976sec
inet6 fe80::b7f7:2aa8:7eeb:1851/64 scope link
valid_lft forever preferred_lft forever
3: enp4s6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:00:e8:f9:74:75 brd ff:ff:ff:ff:ff:ff
activating bridge (when activating the bridge I am left without internet connection on my lxc Debian 9 server):
~# ifup bt0
~# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master bt0 state DOWN group default qlen 1000
link/ether 74:d4:35:5e:e0:7a brd ff:ff:ff:ff:ff:ff
3: enp4s6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:00:e8:f9:74:75 brd ff:ff:ff:ff:ff:ff
61: bt0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 74:d4:35:5e:e0:7a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.200/24 brd 192.168.0.255 scope global bt0
valid_lft forever preferred_lft forever
inet6 fe80::76d4:35ff:fe5e:e07a/64 scope link
valid_lft forever preferred_lft forever
Turn off my Debian 9 server and the bridge works correctly in my container, also update my old containers in your conf file with the new bridge data (bt0) and correctly assign me ip
If I have any problem related to this topic I will continue posting here
Regards!!