LXC - Centos 8

 

 

 


Config host as LXC Hypervisor

 

 

[0]

dnf install rsyslog -y

systemctl enable rsyslog

systemctl start rsyslog

[1]

dnf install lxc-extra lxc lxc-templates -y

systemctl start lxc.service

systemctl enable lxc.service

[2]

nmcli con add type bridge con-name lxcbr0

nmcli con mod bridge-lxcbr0 connection.id lxcbr0

nmcli con mod lxcbr0 bridge.stp no

nmcli con mod lxcbr0 connection.zone internal

nmcli con mod lxcbr0 ipv4.method manual ipv4.addr "192.168.200.254/24"

nmcli con mod lxcbr0 ipv6.method disabled

nmcli con up lxcbr0

# Checking

nmcli con sh

NAME         UUID                                  TYPE      DEVICE
System eth0  dcfcf8b4-1b71-4a7a-9725-b5a3dd1e37af  ethernet  eth0
lxcbr0       68c38d8d-c3a4-4c10-93ff-4004a21c0830  bridge    lxcbr0

[3]

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf

cat /proc/sys/net/ipv4/ip_forward

sysctl -p -q

1

firewall-cmd --get-active-zone

internal
  interfaces: lxcbr0
public
  interfaces: eth0

firewall-cmd --zone=public --add-masquerade --permanent

firewall-cmd --reload

[4]

ln -s /var/lib/lxc /lxc