2017-12-02 22:02:37 +00:00
|
|
|
****
|
|
|
|
Host
|
|
|
|
****
|
2017-12-05 21:14:15 +00:00
|
|
|
|
2019-07-31 19:02:18 +00:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
lxc service has to be enabled for autostart to work
|
|
|
|
|
2017-12-05 21:14:15 +00:00
|
|
|
Check
|
|
|
|
=====
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
lxc-checkconfig
|
|
|
|
|
|
|
|
List
|
|
|
|
====
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
lxc-ls -f
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
lxc-ls --fancy
|
|
|
|
|
|
|
|
Network bridge
|
|
|
|
==============
|
|
|
|
|
2018-07-25 21:38:26 +00:00
|
|
|
Create bridge br0 onto host's network main interface:
|
2017-12-05 21:14:15 +00:00
|
|
|
|
2018-07-25 21:38:26 +00:00
|
|
|
* /etc/network/interfaces.d/br0
|
2017-12-05 21:14:15 +00:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2020-03-20 11:31:41 +00:00
|
|
|
auto br0
|
|
|
|
|
|
|
|
iface br0 inet static
|
|
|
|
bridge_fd 0
|
|
|
|
bridge_maxwait 0
|
|
|
|
bridge_ports eth0
|
|
|
|
bridge_stp off
|
|
|
|
address host_ip/network_mask_bits
|
|
|
|
|
|
|
|
iface br0 inet static
|
|
|
|
address host_ip/network_mask_bits
|
|
|
|
gateway gateway_ip
|
|
|
|
|
|
|
|
iface br0 inet6 static
|
|
|
|
address host_ip/network_mask_bits
|
|
|
|
gateway gateway_ip
|
2017-12-05 21:14:15 +00:00
|
|
|
|
2018-07-25 21:38:26 +00:00
|
|
|
Example with a SoYouStart server:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
auto br0
|
2020-03-20 11:31:41 +00:00
|
|
|
|
2018-07-25 21:38:26 +00:00
|
|
|
iface br0 inet static
|
|
|
|
bridge_fd 0
|
|
|
|
bridge_maxwait 0
|
|
|
|
bridge_ports enp4s0
|
2020-03-20 11:31:41 +00:00
|
|
|
bridge_stp off
|
|
|
|
address 10.0.0.254/24
|
|
|
|
|
|
|
|
iface br0 inet static
|
|
|
|
address 192.99.37.216/24
|
|
|
|
gateway 192.99.37.254
|
|
|
|
|
2018-07-25 21:38:26 +00:00
|
|
|
iface br0 inet6 static
|
|
|
|
address 2607:5300:60:4cd8::/64
|
|
|
|
gateway 2607:5300:60:4cff:ff:ff:ff:ff
|
|
|
|
|
2017-12-05 21:14:15 +00:00
|
|
|
Service
|
|
|
|
=======
|
|
|
|
|
|
|
|
Default configuration for new containers:
|
|
|
|
|
|
|
|
* /etc/lxc/default.conf
|
|
|
|
|
|
|
|
.. code:: ini
|
|
|
|
|
|
|
|
lxc.include = /usr/share/lxc/config/debian.common.conf
|
|
|
|
|
|
|
|
lxc.arch = amd64
|
|
|
|
lxc.autodev = 1
|
|
|
|
lxc.kmsg = 0
|
|
|
|
lxc.rootfs.backend = dir
|
|
|
|
lxc.start.auto = 1
|
|
|
|
|
|
|
|
lxc.network.type = veth
|
|
|
|
|
|
|
|
lxc.network.flags = up
|
|
|
|
lxc.network.link = br0
|
|
|
|
lxc.network.name = eth0
|
|
|
|
|
|
|
|
Directories
|
|
|
|
===========
|
|
|
|
|
|
|
|
* 1 for the containers
|
|
|
|
* 1 for their data
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
mkdir --parents "containers/directory"
|
|
|
|
rmdir "/var/lib/lxc"
|
|
|
|
ln --symbolic "containers/directory" "/var/lib/lxc"
|
|
|
|
|
|
|
|
.. code:: shell
|
|
|
|
|
|
|
|
mkdir --parents "data/directory"
|