# Problem about VLAN



## spartacus (Apr 23, 2011)

How to create VLAN with multiple parent NICs?

```
ifconfig vlan0 create
ifconfig vlan0 vlan 100 vlandev em0 up
ifconfig em0 up
```
I only know this way, but I want vlan 100 have mutiple parent NICs.
How to?


----------



## mamalos (Apr 23, 2011)

I think you might be confusing vlan virtual devices with vlan ids. You can create several vlan devices (such as vlan0, vlan1) that each one will have a different parent real interface (such as em0, em1), but have the same vlan id (like vlan 100 in your example). Then you can do whatever you want with them, eg. you can assign IPs to them, you can bridge them and make them have the same broadcast domain, etc.


----------



## spartacus (Apr 23, 2011)

mamalos said:
			
		

> I think you might be confusing vlan virtual devices with vlan ids. You can create several vlan devices (such as vlan0, vlan1) that each one will have a different parent real interface (such as em0, em1), but have the same vlan id (like vlan 100 in your example). Then you can do whatever you want with them, eg. you can assign IPs to them, you can bridge them and make them have the same broadcast domain, etc.



I want to create a vlan that have several parent real interfaces.eg:

```
ifconfig vlan0 vlan 100 vlandev em0 vlandev em1 up
```
BUT, it's wrong!

```
ifconfig vlan0 vlan 100 vlandev bridge0 up
```
It's also wrong!
I just want the vlan100 up when em0 down!


----------



## mamalos (Apr 23, 2011)

I am not sure I understand what you wish to do. If you bridge your vlan interfaces, instead of creating a vlan interface with a parent interface that is a bridge interface, won't work for your case?


----------



## aragon (Apr 23, 2011)

Sounds like you need to create a lagg(4) device with em0 and em1 as laggports, then create a vlan device with your lagg device as its vlandev.


----------



## spartacus (Apr 24, 2011)

mamalos said:
			
		

> I am not sure I understand what you wish to do. If you bridge your vlan interfaces, instead of creating a vlan interface with a parent interface that is a bridge interface, won't work for your case?



topology:

```
S W I T C H 1 ï¼ˆSTP - ROOT ,Gi0/0,Gi0/1 and Gi0/2 are designated ports)
Gi0/ 0   1   2
     |   |   |
     |   |   |
em   0   1   2
      FreeBSD
em   3   4   5
     |   |   |
     |   |   |
Gi0/ 0   1   2
   S W I T C H 2  (STP - Gi0/0 is Root portï¼ŒGi0/1 and Gi0/2 are in Blocked state)
```
configuration:

```
FreeBSD:
ifconfig bridge0 create
ifconfig bridge0 addm em0 addm em3 -stp em0 -stp em3 up
ifconfig em0 up
ifconfig em3 up

ifconfig bridge1 create
ifconfig bridge1 addm em1 addm em4 -stp em1 -stp em4 up
ifconfig em1 up
ifconfig em4 up

ifconfig bridge2 create
ifconfig bridge2 addm em3 addm em5 -stp em3 -stp em5 up
ifconfig em3 up
ifconfig em5 up

ifconfig vlan0 create
ifconfig vlan0 vlan 100 vlandev em0 192.168.0.254/24 up
```

If em0's state is down, the two SWITCHS can't connect to the Freebsd with VLAN 100.


----------



## spartacus (Apr 24, 2011)

you mean?:

```
FreeBSD:
ifconfig vlan0 create
ifconfig vlan0 vlan 100 vlandev em0 192.168.0.254/24 up

ifconfig bridge0 create
ifconfig bridge0 addm em0 addm em3 addm vlan0 -stp em0 -stp em3 up
ifconfig em0 up
ifconfig em3 up

ifconfig bridge1 create
ifconfig bridge1 addm em1 addm em4 addm vlan0 -stp em1 -stp em4 up
ifconfig em1 up
ifconfig em4 up

ifconfig bridge2 create
ifconfig bridge2 addm em3 addm em5 addm vlan0 -stp em3 -stp em5 up
ifconfig em3 up
ifconfig em5 up
```


----------



## mamalos (Apr 24, 2011)

spartacus,

I am not very familiar with Cisco semantics, so I am not really sure if I still understand you correctly. But from what I understand, what I'd suggest you to do is:


```
# ifconfig vlan0 create vlan 100 vlandev em0 up
# ifconfig vlan1 create vlan 100 vlandev em3 up
```

and then bridge vlan0 and vlan1, something like:

`# ifconfig bridge0 create addm vlan0 addm vlan1 up`

I am not sure if you need stp, this depends on your topology. This means that both em0 and em3 read traffic from vlan-id 100 via their respective virtual interfaces (vlan0 and vlan1), and that the virtual interfaces are bridged.

If that's what you need, it is very easy to deal with the rest of your interfaces accordingly.

Hope this helped.


----------



## spartacus (Apr 25, 2011)

mamalos said:
			
		

> spartacus,
> 
> I am not very familiar with Cisco semantics, so I am not really sure if I still understand you correctly. But from what I understand, what I'd suggest you to do is:
> 
> ...



Thank you, this is what I need. Thank you help me all.


----------

