systemctl disable systemd-networkd
echo "DNS=1.1.1.1 8.8.8.8" >> /etc/systemd/resolved.conf
reboot
nano /var/lib/lxc/VM_NAME/config
# Autostart
lxc.start.auto = 1
lxc.start.delay = 5
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.ipv4.address = 10.0.3.2/24
lxc.net.0.ipv4.gateway = 10.0.3.1
# for openvpn
lxc.mount.entry = /dev/net dev/net none bind,create=dir
lxc.cgroup2.devices.allow = c 10:200 rwm
OLD LXC
#Настройка LXC контейнера:
# Autostart
lxc.start.auto = 1
lxc.start.delay = 5
# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.name = eth1
lxc.network.link = br0
lxc.network.ipv4 = 10.10.10.3/24
lxc.network.ipv4.gateway = 10.10.10.1
# for openvpn
lxc.mount.entry = /dev/net dev/net none bind,create=dir
lxc.cgroup2.devices.allow = c 10:200 rwm
#mount folder
lxc.mount.entry = /home/ /var/lib/lxc/ovpn/rootfs/home/ none bind 0 0
root@host:~# lxc-attach -n bullseye
root@bullseye:~# systemctl list-units|grep network
systemd-networkd.socket loaded active listening Network Service Netlink Socket
network.target loaded active active Network
root@bullseye:~# systemctl stop systemd-networkd
Warning: Stopping systemd-networkd.service, but it can still be activated by:
systemd-networkd.socket
root@bullseye:~# systemctl disable systemd-networkd
Removed /etc/systemd/system/sockets.target.wants/systemd-networkd.socket.
root@bullseye:~# reboot
auto lxcbr0
iface lxcbr0 inet static
bridge_stp off
address 10.0.3.1
broadcast 10.0.3.255
netmask 255.255.255.0
pre-up brctl addbr lxcbr0
post-down brctl delbr lxcbr0