1

I am running an Ubuntu server (server-box), which isrunning an LXD container (lxd-box), and LXD is using an ethernet bridge which I set up using this guide. lxd-box is running an instance of VirtualBox (vbox-box). server-box, lxd-box, and vbox-box are all running Ubuntu 16.04 server. vbox-box is using VirtualBox's ethernet bridging to bridge to eth0 on lxd-box, which is itself bridged to enp5s0 on server-box.

All three are getting assigned an IP address from the LAN. All three can communicate with any other LAN client. Also, lxd-box can communicate fine with server-box and vbox-box. However, vbox-box and server-box cannot communicate. Specifically, I cannot initiate an ssh session between them in either direction, while I can initiate sessions to/from both from/to lxd-box. It's not just ssh, I tested on a handful of ports just initiating raw TCP connections with netcat. Same behavior. ssh is just more convenient.

Anyone know why this is happening? I assume it has to do with the multiple bridging that is occurring, but I'm not sure. More importantly, does anyone know how to fix this?

2

I had a similar problem (though slightly different scenario than yours) and I finally got it solved.

I think when there ara 2 bridges, the first is the lxd bridge and the second is the one virtual box creates, you join them through a tuntap device.

Here are the details

scenario:

  • ubuntu 16.04 with:
  • lxd 2.0 (with lxdbr0) and several containers in it
  • virtualbox machine

In my virtualbox configuration, I made available network adapter and connected it to bridge adapter, choosing lxdbr0. It seemed to work, but then I found the same trouble that you did, couldn't ssh to ubuntu host, couldn't ssh to lxc containers (on same bridge) and so on...

After searching on the internet (sorry I can't provide the links) I found this solution.

On ubuntu 16.04 machine, with root privileges:

root@ubuntu:~# ip tuntap add mode tap tap0
root@ubuntu:~# ip link set tap0 up
root@ubuntu:~# brctl addif lxdbr0 tap0
root@ubuntu:~# brctl show

bridge name bridge id       STP enabled interfaces
lxdbr0      8000.4e76f4d676d5   no      tap0

Once you have your tap0 added to the bridge, you can set up your virtualbox machine "bridge adapter type connection" to connect to tap0 (which is already in the other bridge).

It seems that you should bridge to an interface instead of bridging to a bridge.

In you scenario, you should create the tap0 in your lxd-box. This tap0 will be added to 2 bridges, the one on lxd and the other on virtualbox.

0

To build off the answer from @ayito you can also make a persistent tap0 device. Edit /etc/network/interfaces using root privileges and add:

iface tap0 inet manual
    pre-up ip tuntap add mode tap tap0
    up ip link set tap0 up
    post-up brctl addif lxdbr0 tap0
    pre-down brctl delif lxdbr0 tap0
    down ip link set tap0 down
    post-down ip link del tap0

After saving, run sudo ifup tap0

To validate that it has started run brctl show. You should see tap0 as an interface of lxdbr0.

Every time you restart your computer and want to use the interface, run sudo ifup tap0 Note: you can also add this as a startup script, but it must run after lxdbr0 has started.

In Virtualbox, use a "Bridged Adapter" connected to tap0:

VirtualBox Network

Now you should be able to talk to your LXD containers, and easily setup the tap0 interface after restart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.