Networking issues between lxc and virtualbox guest

Hi,
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 
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx

 egrep -v '^$|^#' /etc/sysconfig/lxc 
LXC_AUTO="true"
BOOTGROUPS="onboot,"
SHUTDOWNDELAY=5
OPTIONS=
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 10.0.3.3.43890 > 8.8.8.8.53: 61589+ SRV? _http._tcp.security.debian.org. (48)
11:05:17.528017 IP 10.0.3.1 > 10.0.3.3: ICMP host 8.8.8.8 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:

lxc.net.0.ipv6.address = 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

HTH

1 Like