I run pure-ftpd, and noticed in their FAQ it list a simple script for limiting bandwidth for ftp, via tc
. So I load up the script, and run it, and love it, then I try to transfer on my local lan, and find it way too slow for my taste for interal. I can not find a way to remove it all, can someone give me alittle more help than 'read the man pages'(because I have read them several times, and do not seem to grasp how to 'remove' the rules, just add them. When I try to 'del' them I get errors about 'We have an error talking to the kernel'. Here is the script.
# Simple bandwidth limiter - <email@example.com>
# Change this to your link bandwidth
# (for cable modem, DSL links, etc. put the maximal bandwidth you can
# get, not the speed of a local Ethernet link)
# Change this to the bandwidth you want to allocate to FTP.
# We're talking about megabits, not megabytes, so 80Kbit is
# 10 Kilobytes/s
# Change this to your physical network device (or 'ppp0')
# Change this to the ports you assigned for passive FTP
tc qdisc add dev "$NIC" root handle 1: cbq \
bandwidth "$REAL_BW" avpkt 1000
tc class add dev "$NIC" parent 1: classid 1:1 cbq bandwidth "$REAL_BW" \
rate "$REAL_BW" maxburst 5 avpkt 1000
tc class add dev "$NIC" parent 1:1 classid 1:10 cbq \
bandwidth "$REAL_BW" rate "$FTP_BW" maxburst 5 avpkt 1000 bounded
tc qdisc add dev "$NIC" parent 1:10 sfq quantum 1514b
tc filter add dev "$NIC" parent 1: protocol ip handle 1 fw flowid 1:10
iptables -t mangle -A OUTPUT -p tcp --sport 20:21 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -p tcp \
--sport "$FTP_PORT_LOW":"$FTP_PORT_HIGH" -j MARK --set-mark 1
Ok, I thought I fixed it, but evidentally not, because now nothing but http traffic works, and its sketchy at best, even after clearing the iptables rules the script added.