LinuxQuestions.org
Visit Jeremy's Blog.
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
  Search this Thread
Old 03-06-2013, 03:50 PM   #1
cat_mucius
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Rep: Reputation: Disabled
Changing Linux Layer2 forwarding decision?


Are there tools to define in Linux something similar to Policy-based Routing, but on Layer2 level? Usual Linux bridge uses destination MAC to decide, which interface to send frame to. Can this behavior be altered?

Let's say we have a machine with several interfaces - physical, virtual, VLAN-tagged subinterfaces, etc. A frame arrives at one of them. Can we decide, which outgoing interface the frame will be delivered to, according to parameters such as VLAN tag in the frame, source MAC address, source interface, 802.1p priority, etc.?
 
Old 03-07-2013, 09:36 AM   #2
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Hello ,

You can use ebtables .

Thanks
 
Old 03-08-2013, 06:05 PM   #3
cat_mucius
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks, vishesh, I read about ebtables, but I haven't found a way how to set them to modify forwarding decision of a bridge or make Linux to push frames to specific interface. All I've found is how to _filter_ the traffic.

Do you have an idea, how ebtables may be used in this fashion?
 
Old 03-08-2013, 06:16 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 683Reputation: 683Reputation: 683Reputation: 683Reputation: 683Reputation: 683
Linux does support VLANs (IEEE 802.11Q). You need to have the the needed kernel modules loaded and configure the bridge devices.

Here is a good article about it from Linux Journal a couple years back:
http://m.linuxjournal.com/article/10821

It includes a contrived example of a firewall with just one interface.

Last edited by jschiwal; 03-08-2013 at 06:20 PM.
 
Old 03-08-2013, 07:12 PM   #5
cat_mucius
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
The link appears to be broken.

Anyway, I know about 802.1q and actually use it in my config. But how does it help me in this case?

My setup looks like this:
* There are several KVM guests with virtual interfaces vnet1, vnet2, etc. These VMs send traffic, which is already VLAN-tagged.
* There are several VLAN-tagged sub-interfaces on the hypervisor: eth1.X, eth1.Y, etc.
* Bridges are used to switch frames between vnets and tagged sub-interfaces - for example, bridge1 unites vnet1, vnet2 and eth1.X.
* So when a guest VM sends frame on its vnet with VLAN tag N, then it's transmitted over physical interface eth1 with two tags: external (X) and internal (N).
* My aim is this: to make external tag be chosen according to the range of internal tags. For example, if N is in [501:600], then frame would be pushed to eth1.X, and the frame will be double-tagged by X:N. Otherwise - by Y:N.

Is there a way to achieve that?
 
Old 03-13-2013, 07:29 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 683Reputation: 683Reputation: 683Reputation: 683Reputation: 683Reputation: 683
QinQ is used for trunking, to wrap your traffic through a trunk which has its own vlan.

A vlan is associated with a particular virtual device so you can use the device e.g. -i eth0.15 in an iptables rule. (I did see an -vlan argument in a thread once, but don't know if it's valid. ).

I don't see why you don't match vlan id's on the hypervisor with the ones on the VMs. From your description, it seems as if you have 10 times the vlans as VMs.

There is also arptables and ebtables. Which might be useful.

Try this link again:
http://www.linuxjournal.com/article/10821
It worked when I checked.

Last edited by jschiwal; 03-13-2013 at 07:40 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forwarding packets without changing source IP CaptainJack Linux - Security 11 06-18-2012 09:54 AM
LXer: Germans Linux migration not taxing decision LXer Syndicated Linux News 0 06-11-2006 07:54 AM
Port forwarding w/o changing router configuration dt4stat Linux - Newbie 1 03-11-2005 02:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:42 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration