Hi, all.
My network :
I and other stations have access to the Internet through an ADSL
modem/router on LAN ; no other hardware, no other LAN segment.
What I want:
I want to throttle the Internet download rate of my own work station
without disturbing others' or pure LAN traffic.
The configuration :
On my Eternet LAN of ip/mask 192.168.2.0/24 I have static IP 192.168.2.2
and my gateway has IP 192.168.2.1 (an ADSL modem + 4-port Ethernet SWITCH).
The problem:
I didn't manage to setup proper QoS/Shaping policies.
Here are the commands I executed in order :
======================================
debian:~/TrafficControl# ./ModProbe
+ export LC_ALL=C
+ LC_ALL=C
+ TC=/sbin/tc
+ IP=/sbin/ip
+ MP=/sbin/modprobe
+ '[' -x /sbin/tc -a -x /sbin/ip ']'
+ HTB_PROBE='sch_htb sch_sfq cls_fw cls_u32 cls_route'
+ for module in '$HTB_PROBE'
+ /sbin/modprobe sch_htb
+ for module in '$HTB_PROBE'
+ /sbin/modprobe sch_sfq
+ for module in '$HTB_PROBE'
+ /sbin/modprobe cls_fw
+ for module in '$HTB_PROBE'
+ /sbin/modprobe cls_u32
+ for module in '$HTB_PROBE'
+ /sbin/modprobe cls_route
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./tc_clear
+ tc qdisc del dev eth0 root
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./ModList
+ lsmod
+ grep '^sch'
sch_sfq 5824 0
sch_htb 16192 0
+ lsmod
+ grep '^cls'
cls_route 6976 0
cls_fw 4992 0
cls_u32 7428 0
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./ShowLinks
+ ip link show
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:16:17:88:46:86 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ieee1394 00:10:dc:00:00:fb:a5:b0 brd ff:ff:ff:ff:ff:ff:ff:ff
4: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./Statistics
+ tc -s -d qdisc show dev eth0
qdisc pfifo_fast 0: bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 184 bytes 4 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
+ tc -s -d class show dev eth0
+ tc filter show dev eth0
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./go_test
--19:48:30--
http://packages.debian.org/testing/a...ages.fr.txt.gz
=> `allpackages.fr.txt.gz.1'
Resolving packages.debian.org... 87.106.4.56
Connecting to packages.debian.org|87.106.4.56|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 390,966 (382K) [text/plain]
100%[====================================>] 390,966 63.53K/s
ETA 00:00
19:48:37 (62.66 KB/s) - `allpackages.fr.txt.gz.1' saved [390966/390966]
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./tc_Throttle_HTB_Internet_Download
+ echo 'Begin of script.'
Begin of script.
+ KBITPSLIMIT=32
+ echo 'We won'\''t download from the Internet at rates higher than 32
KiloBits Per Second.'
We won't download from the Internet at rates higher than 32 KiloBits Per
Second.+ tc qdisc add dev eth0 root handle 1: htb default 11
+ tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit ceil 100mbit
+ tc class add dev eth0 parent 1:1 classid 1:10 htb rate 102368kbit ceil
100mbit+ tc class add dev eth0 parent 1:1 classid 1:11 htb rate 32kbit
ceil 32kbit mpu 64 cburst 2kb burst 4kb
+ tc filter add dev eth0 protocol ip parent 1:0 prio 14 u32 match ip src
192.168.2.0/24 flowid 1:10
+ tc filter add dev eth0 protocol ip parent 1:0 prio 15 u32 match ip src
0.0.0.0/0 flowid 1:11
+ echo 'End of script.'
End of script.
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./ModList
+ lsmod
+ grep '^sch'
sch_sfq 5824 0
sch_htb 16192 1
+ lsmod
+ grep '^cls'
cls_route 6976 0
cls_fw 4992 0
cls_u32 7428 2
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./ShowLinks
+ ip link show
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc htb qlen 1000
link/ether 00:16:17:88:46:86 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ieee1394 00:10:dc:00:00:fb:a5:b0 brd ff:ff:ff:ff:ff:ff:ff:ff
4: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./Statistics
+ tc -s -d qdisc show dev eth0
qdisc htb 1: r2q 10 default 11 direct_packets_stat 0 ver 3.17
Sent 92 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
+ tc -s -d class show dev eth0
class htb 1:11 parent 1:1 prio 0 quantum 1000 rate 32000bit ceil
32000bit burst 4Kb/8 mpu 64b overhead 0b cburst 2Kb/8 mpu 64b overhead
0b level 0
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 1048574 ctokens: 524286
class htb 1:1 root rate 100000Kbit ceil 100000Kbit burst 51587b/8 mpu 0b
overhead 0b cburst 51587b/8 mpu 0b overhead 0b level 7
Sent 92 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 4224 ctokens: 4224
class htb 1:10 parent 1:1 prio 0 quantum 200000 rate 102368Kbit ceil
100000Kbit burst 52770b/8 mpu 0b overhead 0b cburst 51587b/8 mpu 0b
overhead 0b level 0
Sent 92 bytes 2 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
lended: 2 borrowed: 0 giants: 0
tokens: 4221 ctokens: 4224
+ tc filter show dev eth0
filter parent 1: protocol ip pref 14 u32
filter parent 1: protocol ip pref 14 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 14 u32 fh 800::800 order 2048 key ht
800 bkt 0 flowid 1:10
match c0a80200/ffffff00 at 12
filter parent 1: protocol ip pref 15 u32
filter parent 1: protocol ip pref 15 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 15 u32 fh 801::800 order 2048 key ht
801 bkt 0 flowid 1:11
match 00000000/00000000 at 12
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# ./go_test
--19:52:50--
http://packages.debian.org/testing/a...ages.fr.txt.gz
=> `allpackages.fr.txt.gz.2'
Resolving packages.debian.org... 87.106.4.56
Connecting to packages.debian.org|87.106.4.56|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 390,966 (382K) [text/plain]
100%[====================================>] 390,966 62.90K/s
ETA 00:00
19:52:57 (62.31 KB/s) - `allpackages.fr.txt.gz.2' saved [390966/390966]
debian:~/TrafficControl#
======================================
debian:~/TrafficControl# cat Stubborn_Computer > /dev/null
cat: Stubborn_Computer: No such file or directory
debian:~/TrafficControl#
======================================
I don't understand where is the mistake ; I'd have expeted a much slower
download for the 2nd try.
Could please someone help me.
Thanks in advance.
Sincerely,
A.A.