Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
* [LARTC] How to limit bandwidth by port?
@ 2002-12-12 21:11 David Coello
  2002-12-13 14:57 ` Andrea Rossato
  2003-01-03  6:51 ` mdew
  0 siblings, 2 replies; 3+ messages in thread
From: David Coello @ 2002-12-12 21:11 UTC (permalink / raw)
  To: lartc

Hi again

I am making all the test and probes i cann´t imagine but i begin to think 
it´s imposible to limit bandwidth by port. Anybody could put me a code 
example that makes this please?

Thanks and regards
						David Coello



_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LARTC] How to limit bandwidth by port?
  2002-12-12 21:11 [LARTC] How to limit bandwidth by port? David Coello
@ 2002-12-13 14:57 ` Andrea Rossato
  2003-01-03  6:51 ` mdew
  1 sibling, 0 replies; 3+ messages in thread
From: Andrea Rossato @ 2002-12-13 14:57 UTC (permalink / raw)
  To: lartc

DOWNLINK"0
UPLINK\x125
DEV=ppp0

tc qdisc add dev $DEV root handle 1: htb default 10

tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6

tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
    ceil $[UPLINK}kbit burst 6k prio 1

tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[3*$UPLINK/10]kbit\
    ceil $[9*$UPLINK/10]kbit burst 6k prio 2

tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10

tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
         match ip dport 8080 0xffff flowid 1:20


traffic to dport 80 will get 3/10 of bandwith (with possibility to 
borrow up to 9/10)
andrea
David Coello wrote:
> Hi again
> 
> I am making all the test and probes i cann´t imagine but i begin to 
> think it´s imposible to limit bandwidth by port. Anybody could put me a 
> code example that makes this please?
> 
> Thanks and regards
>                         David Coello
> 
> 
> 
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LARTC] How to limit bandwidth by port?
  2002-12-12 21:11 [LARTC] How to limit bandwidth by port? David Coello
  2002-12-13 14:57 ` Andrea Rossato
@ 2003-01-03  6:51 ` mdew
  1 sibling, 0 replies; 3+ messages in thread
From: mdew @ 2003-01-03  6:51 UTC (permalink / raw)
  To: lartc

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

On Sat, 2002-12-14 at 03:57, Andrea Rossato wrote:
> DOWNLINK=220
> UPLINK=125
> DEV=ppp0
> 
> tc qdisc add dev $DEV root handle 1: htb default 10
> 
> tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6
> 
> tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
>     ceil $[UPLINK}kbit burst 6k prio 1
> 
> tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[3*$UPLINK/10]kbit\
>     ceil $[9*$UPLINK/10]kbit burst 6k prio 2
> 
> tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
> tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
> 
> tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
>          match ip dport 8080 0xffff flowid 1:20
> 
> 
> traffic to dport 80 will get 3/10 of bandwith (with possibility to 
> borrow up to 9/10)
> andrea

Andrea, 

I have another script (attached) Im just wondering how i could implement
the above script into it. Im not the most knowledgable on shaping in
general :)

thanks
-mdew (resent-again)





[-- Attachment #2: shaping --]
[-- Type: text/x-sh, Size: 2440 bytes --]

#! /bin/sh

EXT_IFACE=eth0

modprobe imq numdevs=1
# del the qdisc already loaded (if there)
tc qdisc del dev imq0 root

tc qdisc add dev imq0 handle 1: root htb default 12 r2q 1

#          [ HTB queue ]
#                |
#                |
#              [256]  (class 1:1)
#             /  |  \
#            /   |   \
#           /    |    \
#          /     |     \
#         /      |      \
#     [64]       [64]    [128] (note: these add up the the parent's 256)
#     (1:10)     (1:11)  (1:12)
#       |        |        |
#       |        |        |
#     [sfq]    [sfq]    [sfq]
#     (20:0)   (21:0)   (22:0)
# The main link: 252kbit (less is better)
tc class add dev imq0 parent 1: classid 1:1 htb rate 254kbit
# For 10.0.0.9 - 64kbit all to itself - Paul
tc class add dev imq0 parent 1:1 classid 1:10 htb rate 20kbit burst 1kbit prio 1 ceil 36kbit
# For 10.0.0.2 - 64kbit all to itself - Mark
tc class add dev imq0 parent 1:1 classid 1:11 htb rate 20kbit burst 1kbit prio 1 ceil 60kbit
# For 10.0.0.3 and 10.0.0.8 - 128kbit between them - Ryan - Mike
tc class add dev imq0 parent 1:1 classid 1:12 htb rate 200kbit burst 10kbit prio 1 ceil 252kb
it

# SFQ makes things a bit fairer (in theory)
tc qdisc add dev imq0 parent 1:10 handle 20:0 sfq
tc qdisc add dev imq0 parent 1:11 handle 21:0 sfq
tc qdisc add dev imq0 parent 1:12 handle 22:0 sfq

# Match iptables mark 1 and send to class 1:10 (64kbit A)
tc filter add dev imq0 protocol ip pref 1 parent 1: handle 1 fw classid 1:10
# Match iptables mark 2 and send to class 1:11 (64kbit B)
tc filter add dev imq0 protocol ip pref 2 parent 1: handle 2 fw classid 1:11
# Match iptables mark 3 and send to class 1:12 (128kbit)
tc filter add dev imq0 protocol ip pref 3 parent 1: handle 3 fw classid 1:12

# The IMQ device must be up before this will work...
# ip link set imq0 up (set below)

iptables -t mangle -F
iptables -t mangle -X
iptables -t mangle -N incoming
iptables -t mangle -A incoming -d 10.0.0.9 -j MARK --set-mark 1
iptables -t mangle -A incoming -d 10.0.0.2 -j MARK --set-mark 2
iptables -t mangle -A incoming -m mark --mark 1 -j RETURN
iptables -t mangle -A incoming -m mark --mark 2 -j RETURN
iptables -t mangle -A incoming -j MARK --set-mark 3
iptables -t mangle -A FORWARD -i $EXT_IFACE -j incoming
iptables -t mangle -A FORWARD -i $EXT_IFACE -j IMQ

ip link set imq0 up

tc -s -d class show dev imq0

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-03  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-12 21:11 [LARTC] How to limit bandwidth by port? David Coello
2002-12-13 14:57 ` Andrea Rossato
2003-01-03  6:51 ` mdew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox