bridge with default VLAN

Alejandro

New Member


Messages: 11

Hello everyone!
I need help with bridging VLANs and "tap" interfaces for bhyve-VMs. I assume I have misunderstood of networking basics here so please don't kick me too hard.
I've already asked at the churchers/vm-bhyve (https://github.com/churchers/vm-bhyve/issues/155), but no solution so far.
The short version of this question is: Is it posible to have bridge at "parent"(trunk) interface the same time as bridging VLANs of this interface (bridging VLANs and "parent" with "tap" IF-s)? How to solve/bypass this problem?

What I have now:
Host
Code:
#uname -vp
FreeBSD 11.0-RELEASE-p8 #0 r316704: Tue Apr 11 20:26:00 MSK 2017      user0@bhyve0.local:/usr/obj/usr/src/sys/GENERIC  amd64
with 1 interface (igb0) as trunk port for VLANs, 2 VLAN id's ("default"=1 and another one=22), and 1 bhyve-VM so far. I use the sysutils/vm-bhyve to manage VMs.
Code:
# cat /etc/rc.conf
zfs_enable="YES"
ifconfig_igb0="inet 100.1.1.11 netmask 255.255.0.0"
defaultrouter="100.1.1.1"
vlans_igb0="22"
ifconfig_igb0_22="up"
hostname="bhyve0.local"
vm_enable="YES"
vm_dir="zfs:zdata/bhyve"
vm_list="Win12r2"
vm_delay="20"

Code:
# ifconfig
igb0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
         options=6403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
         ether 0c:c4:7a:XX:XX:XX
         inet 100.1.1.11 netmask 0xffff0000 broadcast 100.1.255.255 
         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
         media: Ethernet autoselect (1000baseT <full-duplex>)
         status: active

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
         options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
         inet6 ::1 prefixlen 128 
         inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
         inet 127.0.0.1 netmask 0xff000000 
         nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
         groups: lo 

igb0.22: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
         options=303<RXCSUM,TXCSUM,TSO4,TSO6>
         ether 0c:c4:7a:XX:XX:XX
         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
         media: Ethernet autoselect (1000baseT <full-duplex>)
         status: active
         vlan: 22 vlanpcp: 0 parent interface: igb0
         groups: vlan

bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
         description: vm-public22
         ether 02:c2:88:YY:YY:00
         nd6 options=1<PERFORMNUD>
         groups: bridge 
         id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
         maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
         root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
         member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                 ifmaxaddr 0 port 6 priority 128 path cost 2000000
         member: igb0.22 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                 ifmaxaddr 0 port 4 priority 128 path cost 2000000

tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
         description: vmnet-Win12r2-0-public22
         options=80000<LINKSTATE>
         ether 00:bd:2a:ZZ:ZZ:ZZ
         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
         media: Ethernet autoselect
         status: active
         groups: tap 
         Opened by PID 91231

Code:
# cat ~/bhyve/.config/system.conf:

switch_list="public22"
ports_public22="igb0.22"

Code:
# vm switch list
NAME            TYPE       IDENT       VLAN      NAT          PORTS
public22        auto       bridge0     -         -            igb0.22

Code:
# cat ~/bhyve/Win12r2/Win12r2.conf:

guest="windows"
uefi="yes"
cpu=4
memory=8G
graphics="yes"
graphics_listen="100.1.1.11"
graphics_res="1600x900"
graphics_wait="no"
network0_type="virtio-net"
network0_switch="public22"
network0_mac="58:9c:fc:XX:XX:XX"
disk0_type="ahci-hd"
disk0_name="disk0"
disk0_dev="sparse-zvol"
uuid="XXX-xx-xxx..."

IP "inside" Win12r2-vm is 192.168.22.12/24
It's the working config - host and Win12r2-vm have access to network and internet.
But as soon as I add new bridge (bridge1, vm-switch name=public1) at igb0 with second VM for default VLAN in mind, networking for Win12r2-vm guest stops working.

Code:
...
bridge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vm-public0
        ether 02:c2:88:YY:YY:01
        nd6 options=1<PERFORMNUD>
        groups: bridge 
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: igb0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 2 priority 128 path cost 20000

Removing igb0 from bridge1

Code:
bridge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vm-public0
        ether 02:c2:88:YY:YY:01
        nd6 options=1<PERFORMNUD>
        groups: bridge 
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
turns back working guest network.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,313
Messages: 38,835

Configure the VLAN on the bridge interface; vm switch vlan public22 22 and use the plain igb0 as uplink. Then create your second bridge and also set igb0 as the uplink.

Because igb0 is configured directly (without VLAN tagging) you're using the native (or default) VLAN there. Better would be to treat igb0 as a real trunk and assign the host's IP address to igb0.1 (igb0 + VLAN ID 1). That will make it clearer igb0 is to be treated as a trunk. You would have to add VLAN ID 1 to your second bridge though, similar to your first bridge.
 
Top