# adding a vlan to a bridge



## minimike (Mar 12, 2017)

Hi there

Currently I'm struggeling by adding a vlan to an bridge

The interface re2 is already part of bridge0

```
ifconfig vlan0 create vlan 30 vlandev re2 up
ifconfig vlan0 inet  172.16.232.2/24 up

ping 172.16.232.1
PING 172.16.232.1 (172.16.232.1): 56 data bytes
64 bytes from 172.16.232.1: icmp_seq=0 ttl=64 time=16.668 ms
64 bytes from 172.16.232.1: icmp_seq=1 ttl=64 time=36.284 ms
64 bytes from 172.16.232.1: icmp_seq=2 ttl=64 time=11.570 ms
```
works well

172.16.232.1 is a switch I am logged in over SSH on it
Now I change the IP from the Switch to an IP from the Subnet of the Bridge0 ?


```
ifconfig vlan0 destroy
ifconfig vlan0 create vlan 30 vlandev re2 up
ifconfig addm bridge0 vlan0
ping 10.0.1.254
ping: sendto: Host is down
ping: sendto: Host is down
ping: sendto: Host is down
ping: sendto: Host is down
```

host is down

tcpdump -i bridge0 tells me nothing why or whats happend wrong

Could it be an problem that vlan0 is part of re2 and both re2 and vlan0 are both member of bridge0.
I would like to understand the issue 

best regards Darko


----------



## aa (Mar 12, 2017)

How do you expect subnet 10 answered to 172.16?
(You're not mentioning anything about you're pinging from net 10),
Who and where is that 10.0.1.254 anyway?
You missed to give a very critical information.


----------



## minimike (Mar 12, 2017)

172.16.232.2 is a switch I am logged in over SSH on it
Now I change the IP from the Switch to an IP from the Subnet of the Bridge0 ?

It means that bridge0 and the switch are in the same physical network using Vlan30. I've just changed the IP address of the swith from 172.16 to 10.

bridge has an 10.0.1.0/24 network. If I ceate the Vlan without putting it into the bridge and use a 172.16 net because bridge0 with member r2 is already running with subnet 10.0.1.0/24 I could reach successful my switch.

Putting Vlan30 into the bridge and change the subnet of Vlan30 byside the switch wouldn't work. And now I'm trying to understand why


----------



## usdmatt (Mar 12, 2017)

> Could it be an problem that vlan0 is part of re2 and both re2 and vlan0 are both member of bridge0



Why would you create vlan30 on top of re2, then bridge re2 and vlan30 together? You've completely undone the point of creating a vlan in the first place.

It seems to me that if the switch has a 10 address in vlan30, then you should be creating a vlan30 interface on FreeBSD, and assigning a 10 address to that vlan interface, and scrapping the bridge entirely.

Also I assume this is just wrong in the forum post as it would fail with an error if you actually ran it

```
ifconfig addm bridge0 vlan0
```


----------



## SirDice (Mar 13, 2017)

Your order is wrong. You bridge re1 and re2, then put the vlan(4) on the bridge(4).


----------



## Psylozoff (Mar 25, 2017)

Correct me if I'm wrong but I think vlan interfaces get the MAC address from the interface they are derived from... In this case and if the source interface is in a bridge, aside from its children vlan interfaces, the bridge can't say on which interface should he forward traffic regarding that specific MAC address...


----------

