Simos,
I am using Ubuntu 16.04.04 on a Vbox VM. LXD version 2.21
VirtualBox Graphical User Interface
Version 5.2.2 r119230 (Qt5.6.2)
Using your procedure, like I said, I am not getting an IP from DHCP.
BUT….here’s the weird thing. If I add eth0 to the container interfaces as auto eth0, iface eth0 inet dhcp, I discovered that if I then run tcpdump from the VM host on interface (enp0s3), the container magically gets an IP from DHCP. However I cannot ping anything from inside the container? And I cannot ping the container from outside.
It doesn’t make sense to me why running tcpdump on the VM causes the container to receive an IP? The host VM IP is 192.168.0.40 and the container IP gets 192.168.0.41!
However, I can’t ping the container from my PC nor from the VM. I get “Destination Unreachable”.
I can’t ping the gateway, 192.168.0.1, from the container either.
Here is the container ifconfig after running tcpdump on the VM host:
root@LPC1:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3e:32:ba:fd
inet addr:192.168.0.41 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe32:bafd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:313 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:35935 (35.9 KB) TX bytes:3514 (3.5 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:14 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:1236 (1.2 KB) TX bytes:1236 (1.2 KB
Here is the container ip route after running tcpdump on the host VM:
root@LPC1:~# ip route
default via 192.168.0.1 dev eth0
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.41
Here is the container ifconfig after restarting the container:
root@LPC1:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3e:32:ba:fd
inet6 addr: fe80::216:3eff:fe32:bafd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:2310 (2.3 KB) TX bytes:1534 (1.5 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Here is the container ip route after restarting the container:
root@LPC1:~# ip route
root@LPC1:~#
So, restarting the container, the IP goes away and “ip route” shows nothing.
Run tcpdump on the VM and the IP comes back?
It seems that this is a Vbox issue, but is there an easy way to see if this really is a Vbox issue?
Any ideas? Work arounds?
Thanks,
Ray