# bridge and vlans interfaces



## dekloper (Mar 23, 2015)

Hello!
There is a problem.
I need collect two bridge(4) interfaces and put them in two different vlan(4) interfaces.
How to do it?

In the first bridge all good, because member is physical network card, which is not affixed tag.

```
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
   ether 02:57:47:ef:6a:00
   inet 192.168.1.53 netmask 0xffffff00 broadcast 192.168.1.255
   nd6 options=9<PERFORMNUD,IFDISABLED>
   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: re0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
          ifmaxaddr 0 port 1 priority 128 path cost 20000
   member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
          ifmaxaddr 0 port 8 priority 128 path cost 2000000
```
A second bridge(4) I have a problem, because member is tagged subinterface.

```
bridge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
   ether 02:57:47:ef:6a:01
   inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
   nd6 options=9<PERFORMNUD,IFDISABLED>
   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: re0.2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
          ifmaxaddr 0 port 5 priority 128 path cost 20000
   member: tap2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
          ifmaxaddr 0 port 4 priority 128 path cost 2000000
```
I think that this is due to the effect of STP per VLAN.

```
# ifconfig bridge1 stp re0.2
ifconfig: unable to set bridge flags: Invalid argument
```
I have been studying this issue for `man bridge`: it lists the sysctl MIBs, but manipulation were unsuccessful 

Please, help solve the problem!


----------



## phoenix (Mar 25, 2015)

Don't mix untagged and tagged vlans on the same interface.  Run the interface in either untagged mode, or tagged mode.

IOW, make another tagged vlan interface for the default vlan:  re0.1

Use that instead of re0 in the first bridge, and both should start to work.


----------



## dekloper (Mar 26, 2015)

Thank you very much for the advice.
It works, but I had to configure vlan interfaces otherwise, because the syntax of the dots, it is impossible to translate into a state of UP in /etc/rc.conf:

```
...
vlans_re0 = "vlan1 vlan2"
create_args_vlan1 = "vlan 1"
create_args_vlan2 = "vlan 2"
ifconfig_vlan1 = "up"
ifconfig_vlan2 = "up"
...
```
Thanks.


----------



## phoenix (Mar 26, 2015)

You don't up the pseudo-interface, you up the physical interface:

```
ifconfig_re0="up"
```
Then add your configuration details for the vlans below that.


----------

