Hello All and thank you for allowing me to ask this question.
I am running an unprivileged custom LXC container that is running on top of a Ubuntu host, that at the same time is running on Virtual Box.
I can currently ping from the LXC all the way to the Windows PC and vice versa,
using the lxcbr0:
enp0s9 lxcbr0 br0
Windows 10 (192.168.80.100) <--> Virtual Box (192.168.80.111 <--> 192.168.80.1) <--> LXC (192.168.80.10)
Here is my question:
In my container I have an application generating data that I want to send all the way to the
Windows pc using the network interfaces. This program opens a TUN/TAP interface to write the data to it, but when I try to link the tap0 to the br0 interface I get this error:
ip tuntap add tap0 mode tap
ip link set dev tap0 up
ip link set tap0 master br0
RTNETLINK answers: Operation not supported
The reason this is happening is because br0 is a veth as specified in the LXC config file bellow, and
for some reason it does not let me link to the tap interface.
enp0s9 lxcbr0 br0
Windows 10 (192.168.80.100) <--> Virtual Box (192.168.80.111 <--> 192.168.80.1) <--> LXC (192.168.80.10) X--X tap0
In the other hand, if I remove the br0 from the LXC config and open the br0 inside the container,
I can successfully link tap0 and br0, and the data goes all the way until br0, but I cant get it out of the
container.
enp0s9 lxcbr0 br0
Windows 10 (192.168.80.100) <--> Virtual Box (192.168.80.111 <--> 192.168.80.1) X--X LXC (192.168.80.10) <-- tap0
How can I link this tap interface to the br0 so the data goes out of the container?
enp0s9 lxcbr0 br0
Windows 10 (192.168.80.100) <--> Virtual Box (192.168.80.111 <--> 192.168.80.1) <--> LXC (192.168.80.10) <-- tap0
This is my /etc/default/lxc-net
USE_LXC_BRIDGE="true"
LXC_BRIDGE="lxcbr0"
LXC_ADDR="192.168.80.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="192.168.80.0/24"
LXC_DHCP_RANGE="192.168.80.2,192.168.80.254"
LXC_DHCP_MAX="253"
this is my /etc/network/interfaces
# Host-only adapter used for communication with windows pc
auto enp0s9
iface enp0s9 inet static
address 192.168.80.111
allow-hotplug lxcbr0
iface lxcbr0 inet dhcp
bridge_ports enp0s9
My Container config:
lxc.include = /usr/share/lxc/config/slackware.common.conf
lxc.include = /usr/share/lxc/config/slackware.userns.conf
# network settings
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:00:C3:C1:DA:78
lxc.network.name = br0
lxc.network.ipv4 = 192.168.80.10/24
lxc.network.ipv4.gateway = 192.168.80.1
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:00:C3:C1:DA:78
lxc.network.name = builtin
# local root is id 231072
lxc.id_map = u 0 231072 65536
lxc.id_map = g 0 231072 65536
# rootfs directory
lxc.rootfs = /mnt/lxcroot
lxc.rootfs.backend = dir
lxc.utsname = custom-lxc
lxc.arch = linux32