Bridge for ubuntu(host)+centos(container) does not work


(Tererero) #1

ubuntu(host)+ubuntu(container) = bridge works flawlessly

ubuntu(host)+centos(container) = bridge does not work

So, I setup a simple br0 bridge with /etc/network/interfaces in the Ubuntu host, and in the container I statically set an available public IP. If the container is ubuntu (official image) it works, when it is the centos/7 image, it does not work.

Seems to be a lack of cloud-init in the centos image?

Method I am using to make an LXD bridge is the "sudo dpkg-reconfigure -p medium lxd" command:
* Would you like to setup a network bridge for LXD containers now? No
* Do you want to use an existing bridge? Yes
* Bridge interface name: br0

Please guide me to what do I have to do to make the centos image work in a bridge. Thanks

  • Distribution: Ubuntu
  • Distribution version: 16.04
  • The output of "lxc info" or if that fails:
    • Kernel version: 4.4.0-104-generic
    • LXC version: 2.0.8-0ubuntu1~16.04.2
    • LXD version: 2.0.11-0ubuntu1~16.04.4
    • Storage backend in use: zfs

(Stéphane Graber) #2

Not much details on what’s going on inside your container.
Do you see an eth0 device in your centos container? What happens if you manually configure its IP?

If you were configuring your container using user.network-config, then indeed that requires cloud-init, which isn’t part of the centos7 image. So you’d either need to manually configure networking (somewhere in /etc/sysconfig I believe) or use lxc file push to push a config file into place before starting the container.