Skip to contentSkip to conversation

Incoming traffic

LARTC mohican 542003 3 participants 6 messages Feb 27, 2007 – Sep 25, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

with the command :
tc filter add dev eth0 parent ffff: protocol ip u32 patch ip src 192.168.2.6police rate 10000kbit burst 10000kbit drop flowid :1 we can limit traffic coming from 192.168.2.6.

I would like:
for 192.168.1.2, 192.168.1.4 limit to 10mbit
for 192.168.1.3, 192.168.1.5 limit to 20mbit
other ip would have no limit.

Is it possible with tc ?

Regards

Olivier.

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

#1 lore raw
Quoted 7 lines · mohican 542003 wrote:

Hello,

with the command :
tc filter add dev eth0 parent ffff: protocol ip u32 patch ip src 192.168.2.6police rate 10000kbit burst 10000kbit drop flowid :1 we can limit traffic coming from 192.168.2.6.

Quoted 6 lines

I would like:
for 192.168.1.2, 192.168.1.4 limit to 10mbit
for 192.168.1.3, 192.168.1.5 limit to 20mbit
other ip would have no limit.

Is it possible with tc ?

Should be possible - do you mean .2 and .4 share 10mbit or get 10mbit each?

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

#2 lore raw
In reply to mohican 542003
Quoted 8 lines · mohican 542003 wrote:

Hello,

I would like that .2 and .4 share 10mbit and .3 and .5 share 20 mbit.

I finally use tcindex that works fine. u32 can only be used with one IP, and iptables cannot mark packet for incoming traffic.

Do you have another suggestion ?

There are things called shared meters - though I think that name is a bit misleading as to their usefullness.

You can use them to make policers from different matches behave as one, so it is possible to do as you want - it won't be a fair share though.

The iptables issue is because the place policers hook changed - on 2.4s and if you config your kernel the right way (don't select packet action, and then select the old/depreciated policer) it will see packets after iptables prerouting, the default on 2.6s is to hook before netfilter.

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

#3 lore raw

[LARTC] incoming traffic

In reply to mohican 542003

Hello,

i made this script :
tc qdisc add dev eth0 handle ffff: ingress

tc filter add dev eth0 parent ffff: protocol ip prio 1 u32 match ip src 138.96.20.0 police index 1 rate 20000kbit burst 20000kbit drop flowid :1

tc filter add dev eth0 parent ffff:1 protocol ip prio 1 u32 match ip src 138.96.20.23 police index 2 rate 15000kbit burst 15000kbit drop flowid :2 tc filter add dev eth0 parent ffff:1 protocol ip prio 1 u32 match ip src 138.96.20.10 police index 3 rate 10000kbit burst 10000kbit drop flowid :3

The main goal is to limit incoming traffic from 138.96.20.23 to 15000kbit and the incoming traffic from 138.96.20.10 to 10000kbit. But the total must not exceed 20000kbit.

Does anyone have an idea ?

Thanks.

Olivier.

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

#4 lore raw

[LARTC] incoming traffic

In reply to mohican 542003

Hello,

i made this script :
tc qdisc add dev eth0 handle ffff: ingress

tc filter add dev eth0 parent ffff: protocol ip prio 1 u32 match ip src 138.96.20.0 police index 1 rate 20000kbit burst 20000kbit drop flowid :1

tc filter add dev eth0 parent ffff:1 protocol ip prio 1 u32 match ip src 138.96.20.23 police index 2 rate 15000kbit burst 15000kbit drop flowid :2 tc filter add dev eth0 parent ffff:1 protocol ip prio 1 u32 match ip src 138.96.20.10 police index 3 rate 10000kbit burst 10000kbit drop flowid :3

The main goal is to limit incoming traffic from 138.96.20.23 to 15000kbit and the incoming traffic from 138.96.20.10 to 10000kbit. But the total must not exceed 20000kbit.

Does anyone have an idea ?

Thanks.

Olivier.

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

#5 lore raw

Re: [LARTC] incoming traffic

In reply to mohican 542003

<skip />

Quoted 4 lines

Hello,

i made this script :
tc qdisc add dev eth0 handle ffff: ingress

<skip />

Quoted 3 lines

The main goal is to limit incoming traffic from 138.96.20.23 to 15000kbit and the incoming traffic from 138.96.20.10 to 10000kbit. But the total must not exceed 20000kbit.

<skip />

Does it work? Afair, such setup is possible only with htb/cbq, not with policing filters. But I can stumble.

If so, consider to use imq (which can be unstable) or to shape outgoing traffic, if it is applicable (e.g., on a router).

If you do not have imq, but use OpenVZ or Xen with network in routed mode, you can try to use htb to shape traffic to a VE.

Signature · 5 lines
Peter V. Saveliev
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc