IP header match in a VLAN tagged packet

"Kumara Sundaram" <[email protected]> Wed, 18 Oct 2006 11:46:20 +0800
Newsgroups gmane.linux.network.bridge.ebtables.user
Message-ID <[email protected]>
Hi,

I need to set traffic shaping rules based on IP address, port number,
MAC address and also VLAN ID. All matches are logical AND.

The following are the tc rules,

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1:0 htb default 2
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 30720kbit ceil 30720kbit

tc class add dev eth0 parent 1:1 classid 1:2 htb rate 10kbit ceil 1000kbit
tc class add dev eth0 parent 1:1 classid 1:3 htb rate 10kbit ceil 2000kbit
tc class add dev eth0 parent 1:1 classid 1:4 htb rate 10kbit ceil 3000kbit

tc filter add dev eth0 protocol all parent 1:0 prio 2 handle 4 fw flowid 1:4

The following rule works for an untagged frame.

Rule 1:
ebtables -t nat -A POSTROUTING -o eth0 -p IPV4 --ip-source
192.168.3.100 --ip-destination 192.168.3.212 --ip-protocol tcp
--ip-destination-port 5001 -j mark --set-mark 4 --mark-target ACCEPT

The following rule works for a tagged frame

Rule 2:
ebtables -t nat -A POSTROUTING -o eth0 -p 802_1Q --vlan-id 2
--vlan-encap IPV4  -s 00:30:1A:01:83:E0 -d 00:30:1A:28:FE:03 -j mark
--set-mark 4 --mark-target ACCEPT

Introducing --ip-source in rule 2 mandates the protocol match to be
IPv4 (-p IPV4) and introducing --vlan-id in rule 1 mandates the
protocol match to be 802.1q (-p 802_1Q)

I need to match a tagged frame for its VLAN ID as well as the IP
addresses,i.e, a combination of all the matches in rule 1 and rule 2
in a single rule.

Thanks,
Kumara

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642