Results 1 to 1 of 1
Hi,
I'm trying to create a traffic shaper using tc and iptables. The download is shaped the same as the upload, but it does not get shaped.
These are the ...
- 05-25-2009 #1Just Joined!
- Join Date
- May 2009
- Posts
- 1
Traffic shaper with tc and iptables does not shape download traffic
Hi,
I'm trying to create a traffic shaper using tc and iptables. The download is shaped the same as the upload, but it does not get shaped.
These are the commands I execute to get the result I now have:
Does anyone know what's wrong or how to create the 2 main discs without the prio?Code:# Main device classes and qdiscs tc qdisc add dev eth0 root handle 1: prio tc qdisc add dev eth0 parent 1:1 handle 10: hfsc default 11 tc class add dev eth0 parent 10: classid 10:1 hfsc sc rate 1000000kbit ul rate 1000000kbit tc qdisc add dev eth0 parent 1:2 handle 20: hfsc default 22 tc class add dev eth0 parent 20: classid 20:1 hfsc sc rate 1000000kbit ul rate 1000000kbit tc class add dev eth0 parent 10:1 classid 10:10 hfsc sc umax 1500b dmax 80ms rate 30kbit ul rate 1000000kbit ## shaper for upload (working) # Low tc filter add dev eth0 parent 10: prio 4 protocol ip handle 51 fw flowid 10:10 # Low (ftp) iptables -t mangle -A SIPSHAPER -p tcp --sport 22 -o eth0 -j MARK --set-mark 51 iptables -t mangle -A SIPSHAPER -p tcp --dport 22 -o eth0 -j MARK --set-mark 51 # Normal (default for this class) tc class add dev eth0 parent 10:1 classid 10:11 hfsc sc umax 1500b dmax 60ms rate 35kbit ul rate 1000000kbit tc filter add dev eth0 parent 10: prio 3 protocol ip handle 52 fw flowid 10:11 # Normal (default, all ports not defined above) # high tc class add dev eth0 parent 10:1 classid 10:12 hfsc sc umax 1500b dmax 55ms rate 40kbit ul rate 1000000kbit tc filter add dev eth0 parent 10: prio 2 protocol ip handle 53 fw flowid 10:12 # High (ssh) iptables -t mangle -A SIPSHAPER -p tcp --sport 80 -o eth0 -j MARK --set-mark 53 iptables -t mangle -A SIPSHAPER -p tcp --dport 80 -o eth0 -j MARK --set-mark 53 iptables -t mangle -A SIPSHAPER -p tcp --sport 443 -o eth0 -j MARK --set-mark 53 iptables -t mangle -A SIPSHAPER -p tcp --dport 443 -o eth0 -j MARK --set-mark 53 Highest (VoIP) tc class add dev eth0 parent 10:1 classid 10:13 hfsc sc umax 1500b dmax 30ms rate 80kbit ul rate 1000000kbit tc filter add dev eth0 parent 10: prio 1 protocol ip handle 54 fw flowid 10:13 # VoIP iptables -t mangle -A SIPSHAPER -p udp --sport 10000:20000 -o eth0 -j MARK --set-mark 54 iptables -t mangle -A SIPSHAPER -p udp --dport 10000:20000 -o eth0 -j MARK --set-mark 54 iptables -t mangle -A SIPSHAPER -p udp --sport 4569 -o eth0 -j MARK --set-mark 54 iptables -t mangle -A SIPSHAPER -p udp --dport 4569 -o eth0 -j MARK --set-mark 54 iptables -t mangle -A SIPSHAPER -p udp --sport 5060:5070 -o eth0 -j MARK --set-mark 54 iptables -t mangle -A SIPSHAPER -p udp --dport 5060:5070 -o eth0 -j MARK --set-mark 54 ## Shaper for download (not doing a thing) # Low tc class add dev eth0 parent 20:1 classid 20:20 hfsc sc umax 1500b dmax 80ms rate 30kbit ul rate 1000000kbit tc filter add dev eth0 parent 20: prio 4 protocol ip handle 55 fw flowid 20:20 # Low (ftp) iptables -t mangle -A SIPSHAPER -p tcp --sport 21 -i eth0 -j MARK --set-mark 55 iptables -t mangle -A SIPSHAPER -p tcp --dport 21 -i eth0 -j MARK --set-mark 55 # Normal (default for this class) tc class add dev eth0 parent 20:1 classid 20:22 hfsc sc umax 1500b dmax 60ms rate 35kbit ul rate 1000000kbit tc filter add dev eth0 parent 20: prio 3 protocol ip handle 56 fw flowid 20:22 # Normal (default, all ports not defined above) #High tc class add dev eth0 parent 20:1 classid 20:24 hfsc sc umax 1500b dmax 55ms rate 40kbit ul rate 1000000kbit tc filter add dev eth0 parent 20: prio 2 protocol ip handle 57 fw flowid 20:24 # High (ssh) iptables -t mangle -A SIPSHAPER -p tcp --sport 143 -i eth0 -j MARK --set-mark 57 iptables -t mangle -A SIPSHAPER -p tcp --dport 143 -i eth0 -j MARK --set-mark 57 ## Highest (VoIP) tc class add dev eth0 parent 20:1 classid 20:26 hfsc sc umax 1500b dmax 30ms rate 80kbit ul rate 1000000kbit tc filter add dev eth0 parent 20: prio 1 protocol ip handle 58 fw flowid 20:26 # VoIP iptables -t mangle -A SIPSHAPER -p udp --sport 10000:20000 -i eth0 -j MARK --set-mark 58 iptables -t mangle -A SIPSHAPER -p udp --dport 10000:20000 -i eth0 -j MARK --set-mark 58 iptables -t mangle -A SIPSHAPER -p udp --sport 4569 -i eth0 -j MARK --set-mark 58 iptables -t mangle -A SIPSHAPER -p udp --dport 4569 -i eth0 -j MARK --set-mark 58 iptables -t mangle -A SIPSHAPER -p udp --sport 5060:5070 -i eth0 -j MARK --set-mark 58 iptables -t mangle -A SIPSHAPER -p udp --dport 5060:5070 -i eth0 -j MARK --set-mark 58 iptables -t mangle --insert POSTROUTING -o eth0 -j SIPSHAPER iptables -t mangle --insert PREROUTING -i eth0 -j SIPSHAPER
thanks in advance


Reply With Quote