Skip to contentSkip to conversation

tc filter

LARTC Jarek Poplawski 2 participants 4 messages Aug 10, 2006 – Aug 21, 2006

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · doudouyam

Hi,
Is it possible to make a filter with tc which exclude an IP like iptables ??

ex:
iptable -t mangle -A PREROUTING -i eth0 -d ! 192.168.1.222
<http://192.168.1.222> -j MARK ...

Maybe there is something like this, I don't know, but you can try two filters in turn e.g.:

# tc filter add dev eth0 parent 1: proto ip pref 100 \
	u32 match ip dst 192.168.1.222 police drop

(or some other "flowid 1:xx" instead of "police drop")

# tc filter add dev eth0 parent 1: proto ip pref 101 \
	u32 match ip dst 192.168.1.0/24 flowid 1:99

Jarek P.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#1 lore raw

On 10-08-2006 15:38, Jarek Poplawski wrote:
...

Quoted 2 lines
# tc filter add dev eth0 parent 1: proto ip pref 100 \
    u32 match ip dst 192.168.1.222 police drop

Should be:

# tc filter add dev eth0 parent 1: proto ip pref 100 \
u32 match ip dst 192.168.1.222 flowid 1: police \ 
              conform-exceed drop/drop

or:

# tc filter add dev eth0 parent 1: proto ip pref 100 \
u32 match ip dst 192.168.1.222 flowid 1: action drop

Jarek P.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#2 lore raw
In reply to Jarek Poplawski
Quoted 4 lines · Jarek Poplawski

Should be:

# tc filter add dev eth0 parent 1: proto ip pref 100 \
u32 match ip dst 192.168.1.222 flowid 1: police \              
conform-exceed drop/drop

Looks a bit iffy but I haven't tried it - I thought that would be drop whether under or over - if it's valid at all without action/ a police rate.

Andy.
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#3 lore raw
In reply to Jarek Poplawski
Quoted 9 lines · Andy Furniss
Quoted 4 lines · Jarek Poplawski

Should be:

# tc filter add dev eth0 parent 1: proto ip pref 100 \
u32 match ip dst 192.168.1.222 flowid 1: police \              
conform-exceed drop/drop

Looks a bit iffy but I haven't tried it - I thought that would be drop whether under or over - if it's valid at all without action/ a police rate.

Maybe I should have written:
"Should be with a fairly current iproute2 and kernel:".

It's so called "New syntax" ("Old syntax" didn't work for me), to add exceed action for zero rate. According to help rate and burst should be included, but it works anyway.

Jarek P.

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc