I have Ubuntu 16 with KVM installed running on the hardware. I have an ubuntu 18 VM running there. Inside the ubuntu 18 I have LXC version 3.0.3 freshly installed from ubuntu repos. I’m trying to make containers there that are able to reach the internet. I’m following a tutorial from the linuxfoundation.
When the container boots up it receives no IP from dhcp (dnsmasq IS running in the ubuntu 18 VM).
In the ubuntu 18 Vm I have:
ens3 - 192.168.122.201/24
lxcbr0 - 10.0.3.1/24
vethRQ1I0A - (no ip)
In the container I have Ubuntu 18 as well, with the following:
eth0 (no ip), and dhclient eth0 does nothing.
However the weird thing is, I can assign a static IP to the container (say 10.0.3.2/24) and it accepts the IP.
I can then ping from Ubuntu 18 VM to the container (10.0.3.1 can ping 10.0.3.2) but NOT from the container to the VM (10.0.3.2 CANNOT ping 10.0.3.1). Routing also doesn’t work, like if I add a default route in the container (ip route add default via 10.0.3.1 dev eth0 proto static), it still cannot reach its own gateway or higher up in the nat.
Ipv4 and v6 forwarding is enabled on the ubuntu 18 VM and the container.
Here is my /etc/default/lxc-net:
This is what I did to start the container:
lxc-create -n bucket -t download – -d ubuntu -r bionic -a amd64
lxc-start -n bucket
lxc-attach -n bucket
And that was it, in the linuxfoundation tutorial it was supposed to just work. I’ve been stuck on this now for several days. Not sure why I have this issue.