Networking issues between lxc and virtualbox guest

I have a virtualbox guest CentOS 8 as lxc host (lxc version 3.0.4) . I’ve created a debian container. But has some issues:

  • The container cannot get ip address using dhclient
  • The container cannot reach internet using fixed address, however the host can reach the container.

LXC configuration is as follows:

# cat /etc/lxc/default.conf = veth = lxcbr0 = up = 00:16:3e:xx:xx:xx

 egrep -v '^$|^#' /etc/sysconfig/lxc 
STOPOPTS="-a -A -s"
USE_LXC_BRIDGE="true"  # overridden in lxc-net
[ ! -f /etc/sysconfig/lxc-net ] || . /etc/sysconfig/lxc-net

CentOS has selinux disabled and no iptables rules…

tcpdump output in Centos 8:

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vethY4R8WQ, link-type EN10MB (Ethernet), capture size 262144 bytes
11:05:17.527975 IP > 61589+ SRV? (48)
11:05:17.528017 IP > ICMP host unreachable - admin prohibited filter, length 84

Packet forwarding is disabled:

# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

I run out of ideas… what am I doing wrong?

Thanks in advance!

Well, I’ve finally figured it out!

There was 2 issues:

  • firewalld was enabled (centos 8 now uses nftables)
  • ipv6 was enabled

So I just added to /etc/lxc/default.conf: = none

And in container in /etc/sysctl.d/99-sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1


1 Like