LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-05-2012, 11:50 AM   #1
kinglizard86
LQ Newbie
 
Registered: Sep 2011
Posts: 4

Rep: Reputation: Disabled
Assign multiple VLAN id to the same port


Hi all,

is it possible to assign multiple VIDs to the same port using brctl and vconfig?

Suppose you have a linux box with three ethernet interfaces (eth0, eth1, eth2). I want to configure eth0 in trunking mode with VID 10,20,30 and put eth1 on VLAN 20 and eth2 on VLAN 30. This is achievable with the following commands:

Code:
vconfig add eth0 20
vconfig add eth0 30
brctl addbr br20
brctl addbr br30
brctl addif br20 eth0.20
brctl addif br20 eth1
brctl addif br30 eth0.30
brctl addif br30 eth2
This way packets tagged with 10 that arrives at eth0 are sent out untagged on eth1 and packets tagged with 20 that arrives to eth0 are sent out untagged on eth2.

Now if I want to assign both eth1 and eth2 also to VLAN 10 what should I do? And is it possible or not?

Thanks.

Last edited by kinglizard86; 12-06-2012 at 03:14 AM. Reason: fixed bridges names
 
Old 12-06-2012, 12:13 AM   #2
nini09
Member
 
Registered: Apr 2009
Posts: 916

Rep: Reputation: 67
Yes, an interface can belong to multi VLAN and a VLAN can include multi interface.
 
Old 12-06-2012, 03:23 AM   #3
kinglizard86
LQ Newbie
 
Registered: Sep 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Ok. But, how can I practically achieve that with vconfig and brctl? I have different solutions in my mind, but all of them imply that one interface should belong to two bridges, and I know that this is not possible.
For example, I could create a third VLAN virtual interface on eth0:
Code:
 vconfig add eth0 10
and a new bridge to handle that VLAN
Code:
brctl addbr br10 
brctl addif br10 eth0.10
But I can't add eth1 or eth2 to br10 because they already belong to another bridge.
 
Old 12-06-2012, 02:10 PM   #4
nini09
Member
 
Registered: Apr 2009
Posts: 916

Rep: Reputation: 67
An interface can only be added into one bridge. Why do you want to add one interface into two bridge?
 
Old 12-06-2012, 02:39 PM   #5
kinglizard86
LQ Newbie
 
Registered: Sep 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
I think that the way to handle VLANs in a linux box with multiple interfaces is to create one bridge for each VLAN you want to manage (e.g. br10, br20..)and then add to each bridge the interfaces you want to be on that VLAN. Maybe my hypothesis is wrong.
But I have another question. Suppose to have one interface belonging to two different VLANs. How untagged packets that enter to that interface are handled? Toward which VLAN are they forwarded?
 
Old 12-07-2012, 02:51 PM   #6
nini09
Member
 
Registered: Apr 2009
Posts: 916

Rep: Reputation: 67
Linux will support tagged and untagged interfaces. The eth0 interface is untagged. All vconfiged interfaces (eth0.n) are tagged. The untagged packets are handled by real physical interface.
 
Old 12-07-2012, 03:14 PM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,956
Blog Entries: 1

Rep: Reputation: 81
This is some very nice crap that I haven't studied much in linux. That means you can have both tagged and untagged traffic going out of a single physical interface/link? Cool!
 
Old 12-07-2012, 03:16 PM   #8
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,956
Blog Entries: 1

Rep: Reputation: 81
how about when you want to have one IP in certain vlan to which you have two interfaces connected? should bridge the vconfiged interfaces and set the IP address on the bridge, right?
 
Old 12-09-2012, 04:50 PM   #9
nini09
Member
 
Registered: Apr 2009
Posts: 916

Rep: Reputation: 67
Yes, you can have both tagged and untagged traffic on same physical interface.
 
Old 12-13-2012, 03:47 AM   #10
kinglizard86
LQ Newbie
 
Registered: Sep 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by nini09 View Post
Yes, an interface can belong to multi VLAN and a VLAN can include multi interface.
In order to belong to multiple VLAN an interface must be tagged. Otherwise, how does it know to what VLAN incoming untagged packets belong to?
 
Old 12-13-2012, 02:15 PM   #11
nini09
Member
 
Registered: Apr 2009
Posts: 916

Rep: Reputation: 67
That's why I say, the untagged packets are handled by real physical interface.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dhcp in multiple vlan divyashree Linux - Newbie 8 08-09-2011 03:27 AM
One dedicated vlan port and one tagged port, share IP? jeriryan Linux - Networking 2 02-11-2011 06:24 PM
dhcpd3 doesn't assign proper addresses to vlan subnets DoDo1975 Linux - Networking 3 10-22-2009 03:57 PM
vlan - multiple ip -same nic lord-fu Linux - Networking 1 12-06-2007 03:20 PM
Multiple interfaces in one VLAN Fund-A-Mental Linux - Networking 1 03-06-2007 07:44 AM


All times are GMT -5. The time now is 01:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration