Linux – How to configure multiple tap interfaces for a single KVM virtual machine

debiankvm-virtualizationlinuxnetworkingvirtualization

I am trying to setup a VM using Linux KVM for a F5 BIG-IP VE deployment (used in a lab) https://support.f5.com/content/kb/en-us/products/big-ip_ltm/manuals/product/bigip-ve-kvm-setup-11-3-0/_jcr_content/pdfAttach/download/file.res/BIG-IP®_Virtual_Edition_Setup_Guide_for_Linux_KVM.pdf.

This VM requires 3 different network interfaces (management, external connection, and internal connection)

I have been trying to setup these connections in /etc/network/interfaces with the following configuration:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto

auto br0
iface br0 inet dhcp
   pre-up ip tuntap add dev tap0 mode tap user root
   pre-up ip tuntap add dev tap1 mode tap user root
   pre-up ip tuntap add dev tap2 mode tap user root
   pre-up ip link set tap0 up
   pre-up ip link set tap1 up
   pre-up ip link set tap2 up
   bridge_ports all tap0 tap1 tap2
   bridge_stp off
   bridge_maxwait 0
   bridge_fd      0
   post-down ip link set tap0 down
   post-down ip link set tap1 down
   post-down ip link set tap2 down
   post-down ip tuntap del dev tap0 mode tap
   post-down ip tuntap del dev tap1 mode tap
   post-down ip tuntap del dev tap2 mode tap

Although whenever I go to configure the VM, only one of the tap interfaces will show up as being associated with the bridge. I spent 4-5 hours just trying to get those interfaces working and did not have any luck. What am I doing wrong here?

enter image description here

Best Answer

All you need to set up on the host is the bridge. When you configure virtual NICs, and attach them to the VM, the taps will get created automatically, when the VM is started.

Now, without reading the actual guide, it looks like you need three interfaces on three DIFFERENT networks. If you plug all your virtual NICs into the same bridge (effectively, a virtual switch), they all end up on the same L2 network. You can get by on simple subnetting of course, but if you wantto use VLANs, you need to create a separate bridge on every VLAN tagged interface, and plug the virtual NICs accordingly

Related Topic