I've been battling issues with bandwidth shaping on the wl-700ge with a custom firmware installed using wondershaper (the GUI bandwidth doesn't work). The objective is "simple". I am trying to limit outbound FTP traffic so that I can use my network without having FTP transfers (from the server) choke my network and also allow my network activities (email, web, torrent) to take priority over FTP when needed (while allowing FTP a minimum amount). I don't want to touch my download speeds.

My bandwidth is 5000kbps down and 650kbps up (pretty constant on multiple checks)

The goal for the FTP is a minimum of 120kbps with a max of 480kbps and a lower priority so that if I'm doing other uploading then FTP is forced towards its minimum rate.

Now when I start wondershaper, I get the end result of BOTH my up speed and down speeds capping to 600kbps (checking using speedtest.net). If I increase the uplink parameter to some crazy level (like 7000kbps) and increase the ceil (on classid 1:20) up to any number higher than 600kbps my downloads are restored (to a max of whatever number was entered eg 700 > 700kbps, 6000 > 5000kbps [my actual max])... but the uploads are no longer capped (they go to uncapped max of 650kbps).

I'm guessing that something in the script is not right and I'm hoping someone might be able to help.

I've tried many edits and also just turned off the ingress filter altogether (trying to reduce variables).

Here are my launch command, script, launch response and status results.

launch command
Code:
wshaper start eth0 4800 600 "" "" "20 21" ""
wshaper script (had to hard code the rates that involved math as I got syntax errors for some reason).
PHP Code:
#!/bin/sh
# Wonder Shaper, last modified by Robert Koch (aka akbor)
#
# Set the following values to somewhat less than your actual download
# and uplink speed. In kilobits. Also set the device that is to be shaped.

DOWNLINK=$3
UPLINK
=$4
DEV
=$2

# low priority OUTGOING traffic - you can leave this blank if you want
# low priority source netmasks
NOPRIOHOSTSRC="$5"

# low priority destination netmasks
NOPRIOHOSTDST="$6"

# low priority source ports
NOPRIOPORTSRC="$7"

# low priority destination ports
NOPRIOPORTDST="$8"

if [ "$1" "status" ]
then
        tc 
-s qdisc ls dev $DEV
        tc 
-class ls dev $DEV
        
exit
fi

# clean existing down- and uplink qdiscs, hide errors
tc qdisc del dev $DEV root    2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2
> /dev/null > /dev/null

if [ "$1" "stop" 
then 
        
exit
fi

########## uplink ##########

# install root HTB, point default traffic to 1:20:
tc qdisc add dev $DEV root handle 1htb default 20

# shape everything at $UPLINK speed - this prevents huge queues in your
# DSL modem which destroy latency:
tc class add dev $DEV parent 1classid 1:1 htb rate ${UPLINK}kbit \
  
ceil ${UPLINK}kbit burst 6k

# high prio class 1:10 - gets 40 to 100% traffic and highest priority:
# tc class add dev $DEV parent 1:1 classid 1:10 htb rate $((4*$UPLINK/10))kbit \
#   ceil ${UPLINK}kbit burst 6k prio 1

tc class add dev $DEV parent 1:1 classid 1:10 htb rate 240kbit \
  
ceil 600kbit burst 6K prio 1
 
# bulk & default class 1:20 - gets 40 to 100% traffic and lower priority: 
# tc class add dev $DEV parent 1:1 classid 1:20 htb rate $((4*$UPLINK/10))kbit \
#   ceil ${UPLINK}kbit burst 6k prio 2

tc class add dev $DEV parent 1:1 classid 1:20 htb rate 240kbit \
  
ceil 600kbit burst 6k prio 2

# lowest priority class 1:30 - gets 20 to 80% traffic and lowest priority:
# tc class add dev $DEV parent 1:1 classid 1:30 htb rate $((2*$UPLINK/10))kbit \
#   ceil $((8*$UPLINK/10))kbit burst 6k prio 3

tc class add dev $DEV parent 1:1 classid 1:30 htb rate 120kbit \
  
ceil 480kbit burst 6k prio 3

# all get Stochastic Fairness:
tc qdisc add dev $DEV parent 1:10 handle 10sfq perturb 10
tc qdisc add dev $DEV parent 1
:20 handle 20sfq perturb 10
tc qdisc add dev $DEV parent 1
:30 handle 30sfq perturb 10

# high priority for VoIP traffic (by TOS)
# tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 \
#   match ip tos 0x68 0xff \
#   match ip protocol 0x11 0xff \
#   flowid 1:10
# tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 \
#   match ip tos 0xb8 0xff \
#   match ip protocol 0x11 0xff \
#   flowid 1:10

# high priority for VoIP traffic (by source port)
# tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 \
#   match ip sport 5004 0xffff \
#   match ip protocol 0x11 0xff \
#   flowid 1:10
# tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 \
#   match ip sport 5060 0xffff \
#   match ip protocol 0x11 0xff \
#   flowid 1:10
   
# TOS Minimum Delay (ssh, NOT scp) in 1:10:
tc filter add dev $DEV parent 1:0 protocol ip prio 3 u32 \
  
match ip tos 0x10 0xff \
  
flowid 1:10
    
# ICMP (ip protocol 1) in the interactive class 1:10 so we 
# can do measurements & impress our friends:
tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 \
  
match ip protocol 1 0xff \
  
flowid 1:10

# To speed up downloads while an upload is going on, put ACK packets in
# the interactive class:
tc filter add dev $DEV parent 1protocol ip prio 2 u32 \
  
match ip protocol 6 0xff \
  
match u8 0x05 0x0f at 0 \
  
match u16 0x0000 0xffc0 at 2 \
  
match u8 0x10 0xff at 33 \
  
flowid 1:10

# some traffic however suffers a worse fate
for a in $NOPRIOPORTDST
do
        
tc filter add dev $DEV parent 1protocol ip prio 14 u32 \
          
match ip dport $a 0xffff flowid 1:30
done

for a in $NOPRIOPORTSRC
do
        
tc filter add dev $DEV parent 1protocol ip prio 15 u32 \
          
match ip sport $a 0xffff flowid 1:30
done

for a in $NOPRIOHOSTSRC
do
        
tc filter add dev $DEV parent 1protocol ip prio 16 u32 \
          
match ip src $a flowid 1:30
done

for a in $NOPRIOHOSTDST
do
        
tc filter add dev $DEV parent 1protocol ip prio 17 u32 \
          
match ip dst $a flowid 1:30
done

# rest is 'non-interactive' ie 'bulk' and ends up in 1:20
# tc filter add dev $DEV parent 1: protocol ip prio 1 u32 \
#  match ip dst 0.0.0.0/0 flowid 1:20

########## downlink ##########

# slow downloads down to somewhat less than the real speed  to prevent 
# queuing at our ISP. Tune to see how high you can set it.
# ISPs tend to have *huge* queues to make sure big downloads are fast
#
# attach ingress policer:
# tc qdisc add dev $DEV handle ffff: ingress

# filter *everything* to it (0.0.0.0/0), drop everything that's
# coming in too fast:
# tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
#  0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1 
launch results (the errors are I think in the sfq commands)
PHP Code:
req.n.nlmsg_len:36
req
.n.nlmsg_flags:1537
req
.n.nlmsg_type:36
argv
[7]: 20
argv
[6]: default
argv[5]: htb
argv
[4]: 1:
argv[3]: handle
argv
[2]: root
argv
[1]: eth0
argv
[0]: dev
LOOP
argc8argvdev
LOOP
argc6argvroot
LOOP
argc5argvhandle
LOOP
argc3argvhtb
_________________________
argv
[1]: 20
argv
[0]: default
test4-1
req
.n.nlmsg_len:36
req
.n.nlmsg_flags:1537
req
.n.nlmsg_type:36
argv
[8]: 10
argv
[7]: perturb
argv
[6]: sfq
argv
[5]: 10:
argv[4]: handle
argv
[3]: 1:10
argv
[2]: parent
argv
[1]: eth0
argv
[0]: dev
LOOP
argc9argvdev
LOOP
argc7argvparent
LOOP
argc5argvhandle
LOOP
argc3argvsfq
_________________________
argv
[1]: 10
argv
[0]: perturb
test4
-1
RTNETLINK answers
Invalid argument
test3
-1
req
.n.nlmsg_len:36
req
.n.nlmsg_flags:1537
req
.n.nlmsg_type:36
argv
[8]: 10
argv
[7]: perturb
argv
[6]: sfq
argv
[5]: 20:
argv[4]: handle
argv
[3]: 1:20
argv
[2]: parent
argv
[1]: eth0
argv
[0]: dev
LOOP
argc9argvdev
LOOP
argc7argvparent
LOOP
argc5argvhandle
LOOP
argc3argvsfq
_________________________
argv
[1]: 10
argv
[0]: perturb
test4
-1
RTNETLINK answers
Invalid argument
test3
-1
req
.n.nlmsg_len:36
req
.n.nlmsg_flags:1537
req
.n.nlmsg_type:36
argv
[8]: 10
argv
[7]: perturb
argv
[6]: sfq
argv
[5]: 30:
argv[4]: handle
argv
[3]: 1:30
argv
[2]: parent
argv
[1]: eth0
argv
[0]: dev
LOOP
argc9argvdev
LOOP
argc7argvparent
LOOP
argc5argvhandle
LOOP
argc3argvsfq
_________________________
argv
[1]: 10
argv
[0]: perturb
test4
-1
RTNETLINK answers
Invalid argument
test3
-
Status results
PHP Code:
qdisc htb 1r2q 10 default 20 direct_packets_stat 0
statistics truncated
 
class htb 1:1 root rate 600Kbit ceil 600Kbit burst 6Kb cburst 2367b 
 Sent 12224 bytes 148 pkts 
(dropped 0overlimits 0
 
rate 204bps 2pps 
 lended
0 borrowed0 giants0
 tokens
62638 ctokens22360

class htb 1:10 parent 1:1 prio 1 rate 240Kbit ceil 600Kbit burst 6Kb cburst 2367b 
 Sent 1196 bytes 18 pkts 
(dropped 0overlimits 0
 
rate 2bps 
 lended
18 borrowed0 giants0
 tokens
162134 ctokens24576

class htb 1:20 parent 1:1 prio 2 rate 240Kbit ceil 600Kbit burst 6Kb cburst 2367b 
 Sent 9348 bytes 112 pkts 
(dropped 0overlimits 0
 
rate 202bps 2pps 
 lended
112 borrowed0 giants0
 tokens
156589 ctokens22360

class htb 1:30 parent 1:1 prio 3 rate 120Kbit ceil 480Kbit burst 6Kb cburst 2213b 
 Sent 1680 bytes 18 pkts 
(dropped 0overlimits 0
 
rate 2bps 
 lended
18 borrowed0 giants0
 tokens
322560 ctokens28240 
Any help would be greatly appreciated.

Thanx in advance.