Skip to contentSkip to conversation

Trivial newbie HTB problem

LARTC Jan Rovner 2 participants 2 messages Aug 25, 2003

lore
Share & tools
lore

Jan Rovner

author
#0 lore raw

Hello,

I'm newbie to HTB and need to solve really simple problem:

I have an single IP internet connection @ 1024kbit attached to a linux box (2.4.21), doing NAT for clients at internal 192.168.1.x network.

I need to setup a simple traffic shaping, for a single PC 192.168.1.2 I wish to guarantee minimum rate of 768kbit, for others 32kbit. Maximum rates must be always full speed (1024kbit) !

Can you please tell me what's wrong with that (wlan0 is the internal iface),
because this does not work (192.168.1.2 does not get the guaranteed bandwidth,
but only a 1/n of bandwidth for case that another n stations saturate the line).

Thank you. My script follows.

tc qdisc del dev wlan0 root

#by default, all clients go through slow :30 class tc qdisc add dev wlan0 root handle 1: htb default 30

tc class add dev wlan0 parent 1: classid 1:1 htb rate 1024kbit ceil 1024kbit

# i wish :10 class 768-1024, :30 class 32-1024
tc class add dev wlan0 parent 1:1 classid 1:10 htb rate 768kbit ceil
1024kbit prio 0
tc class add dev wlan0 parent 1:1 classid 1:30 htb rate 32kbit ceil
1024kbit prio 2

tc qdisc add dev wlan0 parent 1:10 handle 10: sfq perturb 10 tc qdisc add dev wlan0 parent 1:30 handle 30: sfq perturb 10

# client 192.168.1.2 is privileged, should be in :10 class
tc filter add dev wlan0 protocol ip parent 1:0 prio 0 u32 match ip dst
192.168.1.2 flowid 1:10

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 20 lines · Jan Rovner

Hello,

I'm newbie to HTB and need to solve really simple problem:

I have an single IP internet connection @ 1024kbit attached to a linux box (2.4.21), doing NAT for clients at internal 192.168.1.x network.

I need to setup a simple traffic shaping, for a single PC 192.168.1.2 I wish to guarantee minimum rate of 768kbit, for others 32kbit. Maximum rates must be always full speed (1024kbit) !

Can you please tell me what's wrong with that (wlan0 is the internal iface),
because this does not work (192.168.1.2 does not get the guaranteed bandwidth,
but only a 1/n of bandwidth for case that another n stations saturate the line).

Thank you. My script follows.

Quoted 7 lines

tc qdisc del dev wlan0 root

#by default, all clients go through slow :30 class tc qdisc add dev wlan0 root handle 1: htb default 30

tc class add dev wlan0 parent 1: classid 1:1 htb rate 1024kbit ceil 1024kbit

You have to limit the total bandwidth to less then your link bandwidth so YOU are the bottleneck. So take 1000kbit as the ceil and not 1024kbit.

Quoted 5 lines
# i wish :10 class 768-1024, :30 class 32-1024
tc class add dev wlan0 parent 1:1 classid 1:10 htb rate 768kbit ceil
1024kbit prio 0
tc class add dev wlan0 parent 1:1 classid 1:30 htb rate 32kbit ceil
1024kbit prio 2

Give both classes the same prio.

Also see www.docum.org for more info.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/