Here's a snip: #!/bin/bash #set -v iptables='sudo iptables' tc='sudo tc' #$iptables -t mangle -F #$iptables -t mangle -Z ##################### ## Traffic Shaping ##################### ## Parent ID: 1, Associated with iface: eth0 -- External Interface - Internet Side. $tc qdisc del dev eth0 root $tc qdisc add dev eth0 root handle 1: htb r2q 1 $tc class add dev eth0 parent 1:0 classid 1:1 htb rate 900kbit ceil 945kbit ## Optimum Wireless $iptables -t mangle -A POSTROUTING -s 172.16.254.1 -j MARK --set-mark 1226 $iptables -t mangle -A POSTROUTING -s 172.16.254.1 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.10 -j MARK --set-mark 1227 $iptables -t mangle -A POSTROUTING -s 172.16.254.10 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.11 -j MARK --set-mark 1228 $iptables -t mangle -A POSTROUTING -s 172.16.254.11 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.2 -j MARK --set-mark 1229 $iptables -t mangle -A POSTROUTING -s 172.16.254.2 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.3 -j MARK --set-mark 1230 $iptables -t mangle -A POSTROUTING -s 172.16.254.3 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.4 -j MARK --set-mark 1231 $iptables -t mangle -A POSTROUTING -s 172.16.254.4 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.5 -j MARK --set-mark 1232 $iptables -t mangle -A POSTROUTING -s 172.16.254.5 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.6 -j MARK --set-mark 1233 $iptables -t mangle -A POSTROUTING -s 172.16.254.6 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.7 -j MARK --set-mark 1234 $iptables -t mangle -A POSTROUTING -s 172.16.254.7 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.8 -j MARK --set-mark 1235 $iptables -t mangle -A POSTROUTING -s 172.16.254.8 -j RETURN $iptables -t mangle -A POSTROUTING -s 172.16.254.9 -j MARK --set-mark 1236 $iptables -t mangle -A POSTROUTING -s 172.16.254.9 -j RETURN $tc class add dev eth0 parent 1:528 classid 1:1226 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:529 classid 1:1227 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:530 classid 1:1228 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:531 classid 1:1229 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:532 classid 1:1230 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:533 classid 1:1231 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:534 classid 1:1232 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:535 classid 1:1233 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:536 classid 1:1234 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:537 classid 1:1235 htb rate 141kbit ceil 169kbit prio 4 $tc class add dev eth0 parent 1:538 classid 1:1236 htb rate 141kbit ceil 169kbit prio 4 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1226 fw classid 1:1226 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1227 fw classid 1:1227 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1228 fw classid 1:1228 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1229 fw classid 1:1229 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1230 fw classid 1:1230 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1231 fw classid 1:1231 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1232 fw classid 1:1232 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1233 fw classid 1:1233 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1234 fw classid 1:1234 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1235 fw classid 1:1235 $tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1236 fw classid 1:1236 $tc qdisc add dev eth0 parent 1:1226 handle 1018: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1227 handle 1019: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1228 handle 1020: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1229 handle 1021: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1230 handle 1022: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1231 handle 1023: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1232 handle 1024: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1233 handle 1025: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1234 handle 1026: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1235 handle 1027: sfq perturb 2 $tc qdisc add dev eth0 parent 1:1236 handle 1028: sfq perturb 2 Like I mentioned before I've tried PREROUTING, INPUT and POSTROUTING.