# wshaper tweaking

## it290

Ok, I've been using the wondershaper script for a while now and it seems to work well for most of my needs, aiding greatly in lowering latency while doing things such as file sharing.   

However, I have a bit of an issue with it.  My Gentoo box is on my home network, which also contains 1 XP box and 1 Mac.  I use samba and netatalk quite frequently to send files back and forth between these machines, and I also frequently print large files over the network.  All three machines are plugged into a router which in turn is plugged into a DSL modem.  The problem is that whenever wshaper is active, it basically kills samba and appletalk connections, slowing them down to the speed specified for uplink/downlink in the script.  Stopping the script instantly brings the connections back to normal, but having to turn shaping on and off when printing or sharing files reduces the  utility of wondershaper greatly.

So my question is this - does anyone know of a way that I can modify the wondershaper script so that packets going to and from certain hosts are NOT shaped?  I've scoured the LARTC site for quite a while, but didn't see/couldn't decipher anything that would meet my needs exactly, especially since the site is mainly geared towards linux boxes set up for routing purposes, which mine isn't.

----------

## Crg

 *it290 wrote:*   

> 
> 
> So my question is this - does anyone know of a way that I can modify the wondershaper script so that packets going to and from certain hosts are NOT shaped?  I've scoured the LARTC site for quite a while, but didn't see/couldn't decipher anything that would meet my needs exactly, especially since the site is mainly geared towards linux boxes set up for routing purposes, which mine isn't.

 

Make sure you are shaping on the right device, for example the wshaper script I've seen on the boards here is shaping for eth0, whereas in my setup my ADSL connection is over PPP (ppp0), so the script should be shaping on that.

----------

## it290

Yup, eth0 is the right device.  I actually got it working somewhat by adding an unshaped class as 1:1 and bumping everything else down a notch, then adding filters for each of my machines specifying  that their traffic should go into the 1:1 class.  It's still slightly slower than normal, but not dog slow like it was.

However, this only works for copying files from the Gentoo box over to the other machines.   When transferring files in the reverse direction, or printing to the Gentoo machine, it's still really slow - I haven't figured out how to apply the same filters to incoming packets.

----------

## Crg

 *it290 wrote:*   

> All three machines are plugged into a router which in turn is plugged into a DSL modem. The problem is that whenever wshaper is active, it basically kills samba and appletalk connections, slowing them down to the speed specified for uplink/downlink in the script.

 

Just re-read your first post.  The shaper script is for running on a linux box which is acting as the router, if the linux box isn't the router - generally with one internal network device and one external network device which is getting shaped - then its quite pointless running this script.

----------

## mysticalreaper

Crg, you didn't read his first post properly.  I know exactly what he wants, and i have the same problem.  I want un-shaped traffic on the local network, shaped traffic to the rest of the internet.  Because he's using a router (or in my case a hub to the cable modem) he wants to keep using the router, not set up a new linux router box.

And he said the larct site was geared towards linux boxen running as routers, so he coudln't find any relevant info.  Not that what he was trying to do was stupid or impossible.

I hope someone knows an answer to this, cause it would help me out as well.

----------

## Crg

 *mysticalreaper wrote:*   

> and i have the same problem. I want un-shaped traffic on the local network, shaped traffic to the rest of the internet.

 

Unless the linux is the router for the other boxes on the local network, running this shaper script is pretty pointless.

You can easily edit this script to not shape traffic to the local network and to shape all other traffic.

But shaping internet traffic from the linux box isn't overly much point if the shaped/prioritised traffic is then squished down a pipe along with uncontrolled traffic from 2 other machines.

----------

## it290

Well, you have a point Crg, except that in my case the Linux box is used for nearly all of my internet activities ... the other boxes rarely get used for that purpose.  I'm not looking to shape traffic on those machines, I just want to prevent the shaper from interfering with any communication from/to them.  Like I said, I figured out how to not shape outgoing traffic to the local network, but I can't figure out how to prevent the incoming traffic from being shaped- I guess I just need to read the docs a little more.

----------

## Crg

 *it290 wrote:*   

> Well, you have a point Crg, except that in my case the Linux box is used for nearly all of my internet activities ... the other boxes rarely get used for that purpose.  I'm not looking to shape traffic on those machines, I just want to prevent the shaper from interfering with any communication from/to them.  Like I said, I figured out how to not shape outgoing traffic to the local network, but I can't figure out how to prevent the incoming traffic from being shaped- I guess I just need to read the docs a little more.

 

shouldn't changes something similar to below do what you want?

```

# Speed of local network ie 10/100/1000 lan.

LOCALSPEED=100

# Local net.

LOCALNET="192.168.10.0/24"

... (etc) ...

# shape everything at $UPLINK speed - this prevents huge queues in your

# DSL modem which destroy latency:

/usr/sbin/tc class add dev $DEV parent 1: classid 1:1 htb rate \

                         ${UPLINK}kbit burst 6k

# local network traffic at max lan speed

/usr/sbin/tc class add dev $DEV parent 1: classid 1:2 htb rate \

                         ${LOCALSPEED}mbit

/usr/sbin/tc qdisc add dev $DEV parent 1:2 handle 5: sfq

# Chuck all traffic to local lan into 1:2

/usr/sbin/tc filter add dev $DEV parent 1: protocol ip prio 1 u32 match ip \

                         dst ${LOCALNET} flowid 1:2

# high prio class 1:10:

... (etc) ...

# filter *everything* to it (0.0.0.0/0), drop everything that's

# coming in too fast, but not traffic from local net.

/usr/sbin/tc filter add dev $DEV parent ffff: protocol ip prio 49 u32 match \

                         ip src ${LOCALNET} flowid :1

/usr/sbin/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

            eend $? "Failed to start Traffic Shaping"

```

----------

