[Techtalk] Linux QoS traffic shaping

Mary mary-linuxchix at puzzling.org
Sat Apr 12 19:24:16 EST 2003


I have the following network set up:

192.168.0.1 is a gateway, which connects to the internet at large using
a dialup modem (interface ppp0). It connects to an internal network
(192.168.0/24) on eth0. 192.168.0.1 uses iptables to masquerade for
192.168.0/24. Masquerading works fine.

192.168.0.2 and 192.168.0.3 are hosts that connect to the internet
through gateway 192.168.0.1. They connect just fine.

However, the respective users of 192.168.0.2 and 192.168.0.3 are sharing
the bandwidth of a 56K modem and I would like to apply traffic shaping
rules to achieve the following:

1. Any TCP/IP session, from any of the hosts, can use the full bandwidth
of the modem if it has no competition.

2. IRC, ssh and telnet sessions (more precisely, sessions connecting to
6667, 22 or 23 on a host on the internet at large) are top priority no
matter which host they come from.

3. HTTP and FTP traffic (sessions connecting to 80 and 21) are second
priority.

4. IMAP, IMAP-SSL and SMTP are third priority.

I am trying to follow the Linux Advanced Routing & Traffic Control HOWTO
at http://lartc.org/howto/index.html, particularly 9.5. Classful
Queueing Disciplines at http://lartc.org/howto/lartc.qdisc.classful.html

I have tried setting this up on 192.168.0.1. 192.168.0.1 is running a
2.4.20 kernel (stock Debian - all appropriate modules exist).

This is the current state of the system:

# tc -s -d class show dev ppp0
class htb 1:1 root rate 5Kbit ceil 5Kbit burst 255b/8 mpu 0b cburst 1605b/8 mpu
0b level 7
 Sent 594127 bytes 9412 pkts (dropped 0, overlimits 0)
 rate 39bps
 lended: 324 borrowed: 0 giants: 0
 tokens: 266240 ctokens: 1994240
 
class htb 1:10 parent 1:1 leaf 10: prio 0 quantum 1000 rate 2Kbit ceil 5Kbit burst 255b/8 mpu 0b cburst 1605b/8 mpu 0b level 0
 Sent 137936 bytes 1835 pkts (dropped 0, overlimits 0)
 rate 39bps
 lended: 1765 borrowed: 70 giants: 0
 tokens: 665600 ctokens: 1994240
 
class htb 1:20 parent 1:1 leaf 20: prio 2 quantum 1000 rate 3Kbit ceil 3Kbit burst 255b/8 mpu 0b cburst 1602b/8 mpu 0b level 0
 Sent 400958 bytes 6948 pkts (dropped 0, overlimits 0)
 lended: 6788 borrowed: 160 giants: 0
 tokens: -215040 ctokens: 2556161
 
class htb 1:30 parent 1:1 leaf 30: prio 3 quantum 1000 rate 1Kbit ceil 5Kbit burst 255b/8 mpu 0b cburst 1605b/8 mpu 0b level 0
 Sent 12383 bytes 202 pkts (dropped 0, overlimits 0)
 lended: 179 borrowed: 23 giants: 0
 tokens: 1280000 ctokens: 1984000
 
class htb 1:40 parent 1:1 leaf 40: prio 4 quantum 1000 rate 64bps ceil 3Kbit burst 255b/8 mpu 0b cburst 1602b/8 mpu 0b level 0
 Sent 42850 bytes 427 pkts (dropped 0, overlimits 0)
 lended: 356 borrowed: 71 giants: 0
 tokens: -1429504 ctokens: 3334401

[I know some of those rules don't allow any session to fully utilise the
modem if it doesn't have competition. I was dropping the numbers to see
if I could *see* it work.]

But IRC and ssh sessions still run as slowly during apt-get update
activity (HTTP requests) as they ever did. What am I doing wrong? Do
traffic control rules apply to packets passing through iptables's
FORWARD chain?

-Mary


More information about the Techtalk mailing list