Solved two bridges on 1 i/f

What is the correct way to create two bridges on one interface? I need this for a jail. What I have is this:
Code:
cloned_interfaces="bridge0 bridge1"
ifconfig_bridge0="addm igb0 up"
ifconfig_bridge1="addm igb0 up"

This does not give an error and two bridges are created. However one has igb0 as a member and the other does not:
Code:
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 02:1a:39:ed:22:00
    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 1 priority 128 path cost 20000
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>
bridge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 02:1a:39:ed:22:01
    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
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>

I get the same results if I swap bridge0 for igb0 in bridge1:
Code:
cloned_interfaces="bridge0 bridge1"
ifconfig_bridge0="addm igb0 up"
ifconfig_bridge1="addm bridge0 up"
 
Why would you want that? Just add every interface you want to be bridged to bridge0. Its not possible to add one interface to multiple bridges, because that would effectively behave as if all interfaces on those two bridges would be bridged together - i.e. one bridge is sufficient and the correct way to do it.
 
I assigned both virtual interfaces to the same bridge and things now work as I wished. Thank you.

For those using IOCAGE to configure two separate virt-i/fs on one physical i/f this is the setup that works for me:

rc.conf:
Code:
cloned_interfaces="bridge0"
ifconfig_bridge0="addm igb0 up"

Network settings for jail: sshpipe-3
Code:
allow_raw_sockets:1
allow_set_hostname:1
allow_socket_af:0
allow_sysvipc:1
allow_tun:0
allow_vmm:0
assign_localhost:1
boot:1
host_domainname:none
host_hostname:sshpipe-3
host_hostuuid:sshpipe-3
host_time:1
hostid:dac28570-4f88-0000-0000-000000000000
hostid_strict_check:0
interfaces:vnet0:bridge0,vnet1:bridge0                                         #<== important
ip4:new
ip4_addr:vnet0|A.B.71.124/25,vnet1|192.168.216.124/16                          #<== important
ip4_saddrsel:1
ip6:new
ip6_addr:none
ip6_saddrsel:1
ip_hostname:0
jail_zfs_dataset:iocage/jails/sshpipe-3/data
localhost_ip:127.0.124.1
nat_backend:ipfw
nat_interface:none
resolver:/etc/resolv.conf
state:up
vnet:1
vnet0_mac:7085c214e667 7085c214e668
vnet1_mac:7085c214e331 7085c214e332
vnet2_mac:none
vnet3_mac:none
vnet_default_interface:auto
vnet_interfaces:none
 
Back
Top