-   Linux - Networking (
-   -   Linux VLAN Trunk? (

teamchachi 07-28-2005 11:52 AM

Linux VLAN Trunk?
Can somebody tell me if this would work? And how one would go about it? I'm leaning 90% towards using managed switches, but this is intriguing to me none the less.


Take 2 linux servers and put 3 NICs in each one.

Connect the two linux servers on Eth0 (there can be a switch in between).

Connect eth1 on each server to a subnet ( and eth2 to another subnet (

Tag traffic on eth1 with VLAN1 and inbound traffic on eth2 at VLAN2.

Create a VLAN trunk between the two servers on eth0?

Would this work? Has anybody seen a howto anywhere?


fr_laz 07-28-2005 12:50 PM


configuring the trunk is no problem: as soon as you configure two virtual interfaces in differnet vlans on the same real interface it becomes a trunk:
ifconfig eth0 up
vconfig add eth0 10
vconfig add eth0 20
ifconfig eth0.10
ifconfig eth0.20

the last two lines are only needed if you want to configure ip addresses, which may not be the case if your only building up a switch...

so here's a trunk on eth0

then, you put eth1 in vlan 10
ifconfig eth1 up
vconfig eth1 10
ifconfig eth1.10 up

then you put eth0.10 and eth1.10 in a bridge:
brctl addbr br10
brctl addif br10 eth0.10
brctl addif br10 eth1.10
ifconfig br10 up

(you can do the same with br20 including eth0.20 and eth2.20)

note that if you do this, you should configure ip addresses on the br10 and br20 interfaces instead of on eth0.10 and eth0.20.

note also that you'll need to enable the use of vlans in the kernel (802.1q option) and install the brctl and vconfig that do not come with most distro...

i already tried all this and it worked quite well. the problem i had concerned vlan tagging, which i do not know how you set up ! I already wrote a post about it, but i had no answer and i had no time to investigate further on (i was playing with vconfig for fun, not for work). So if anybody knows how to tag incomming packets, please say so !!!!!

All times are GMT -5. The time now is 10:34 AM.