-
Notifications
You must be signed in to change notification settings - Fork 0
LXC V Server
matveynator edited this page Sep 13, 2024
·
6 revisions
lxc-ls -f
lxc-attach --name lxc.name
lxc-start name
lxc-stop name
vserver-stat
vserver name enter
vserver start name
vserver stop name
curl -L "https://git.io/JMHwJ" > /usr/local/bin/lxc-convert-from-vserver; chmod +x /usr/local/bin/lxc-convert-from-vserver; /usr/local/bin/lxc-convert-from-vserver
#disable systemd-networkd as it is A SHIT:
systemctl disable systemd-networkd;
systemctl disable systemd-resolved;
#INSTALL bridge utils!
apt-get -y install bridge-utils;
sleep 5;
#restart network
/etc/init.d/networking restart;
sleep 5;
systemctl restart networking;
sleep 5;
auto br0
iface br0 inet loopback
bridge_ports none
bridge_fd 0
bridge_hello 2
bridge_maxage 12
bridge_stp off
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eno1
iface eno1 inet manual
auto br0
iface br0 inet static
address 1.2.3.4
netmask 255.255.255.240
gateway 1.2.3.3
bridge_ports eno1
bridge_fd 0
bridge_hello 2
bridge_maxage 12
bridge_stp off
dns-nameservers 1.1.1.1 8.8.8.8
up ip route add 1.2.3.5/32 dev br0
cat > /var/lib/lxc/${name}/config <<EOF
lxc.start.auto = 1
lxc.rootfs.path = /var/lib/lxc/${name}/rootfs
lxc.include = /usr/share/lxc/config/debian.common.conf
lxc.mount.fstab = /var/lib/lxc/${name}/fstab
lxc.uts.name = ${name}
lxc.arch = amd64
lxc.autodev = 1
lxc.cgroup.memory.limit_in_bytes = ${memory}
lxc.cgroup.cpuset.cpus = ${cpus}
lxc.mount.auto = cgroup-full:rw
lxc.apparmor.profile = unconfined
lxc.cgroup.devices.allow = a
lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.name = eth0
lxc.net.0.link = br0
lxc.net.0.ipv4.address = ${eth0ipv4}/${eth0prefix}
lxc.net.0.ipv4.gateway = ${eth0gateway}
EOF