Hi,
I am new to HTB and in the learning process I want to simulate a slower
link on my server to see how qdisc works.
I have a 100Mbit connection.
I want to simulate a 100K connection and to divide traffic between FTP
and SMB. (like in HTB user guide).
The problem is that it doesn’t work. I can transfer files with FTP of
SAMBA at the wire speed. (Just like when there was no HTB and qdisc).
What do I do wrong?
Here is my script:
#!/bin/bash
tc qdisc del dev eth0 root
iptables -F
iptables -F -t mangle
# qdisc for delay simulation
tc qdisc add dev eth0 root handle 100: htb
tc class add dev eth0 parent 100: classid 100:1 htb rate 100kbps
tc qdisc add dev eth0 parent 100:1 handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 50kbps ceil 100kbps prio 1
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 50kbps ceil 100kbps prio 2
tc qdisc add dev eth0 parent 1:10 handle 22: sfq perturb 10
tc qdisc add dev eth0 parent 1:20 handle 23: sfq perturb 10
I've tried with u32 and with fw filter
tc filter add dev eth0 parent 1: protocol ip u32 match ip sport 20 0xffff flowid 1:10
tc filter add dev eth0 parent 1: protocol ip u32 match ip sport 139 0xffff flowid 1:20
OR
iptables -A OUTPUT -o eth0 -t mangle -p tcp --sport 20 -j MARK --set-mark 22
tc filter add dev eth0 parent 1: protocol ip handle 22 fw classid 1:10
iptables -A OUTPUT -o eth0 -t mangle -p tcp --sport 445 -j MARK --set-mark 33
tc filter add dev eth0 parent 1: protocol ip handle 33 fw classid 1:20
Best regards,
ddaas