On 5/1/08, Luiz Vaz <[EMAIL PROTECTED]> wrote:
> Hi,
>
>   I made this simple script and works fine for me.
>
> #!/bin/sh
>
>  #Configuration
> SUBNET="192.168.XXX.XXX/24"
>  LIMIT_PIPEIN="250Kbit/s"
> LIMIT_PIPEOUT="250Kbit/s"
>
> #Load ipfw
> echo -n "Loading IPFW:        "
>  if [ `kldstat | grep -i ipfw | wc -l` -eq 0 ] ; then
>   kldload ipfw
>    echo "OK"
> else
>    echo "NOT NEEDED"
> fi
>
> #Load dummynet
> echo -n "Loading DUMMYNET:    "
>  if [ `kldstat | grep -i dummynet | wc -l` -eq 0 ] ; then
>   kldload dummynet
>    echo "OK"
> else
>    echo "NOT NEEDED"
> fi
>
> #Create Pipe OUT
> echo -n "Creating Pipe OUT:    "
>  if [ `ipfw list | grep -i "pipe 100" | wc -l` -eq 0 ] ; then
>   ipfw add pipe 100 ip from ${SUBNET} to any > /dev/null
>    echo "OK"
> else
>    echo "NOT NEEDED"
> fi
>
> #Create Pipe OUT
> echo -n "Creating Pipe IN:    "
>  if [ `ipfw list | grep -i "pipe 200" | wc -l` -eq 0 ] ; then
>    ipfw add pipe 200 ip from any to ${SUBNET} > /dev/null
>   echo "OK"
>  else
>   echo "NOT NEEDED"
>  fi
>
> #Config Pipe's
>  ipfw pipe 100 config mask src-ip 0x000000ff bw ${LIMIT_PIPEOUT}  queue 10
> ipfw pipe 200 config mask dst-ip 0x000000ff bw ${LIMIT_PIPEIN} queue 10
>
> echo "Pipe in:        ${LIMIT_PIPEIN}"
> echo "Pipe out:        ${LIMIT_PIPEOUT}"
>  echo "Target Subnet:        ${SUBNET}"
> #--end--
>
>   Place this script into /usr/local/etc/rc.d/ and use chmod to 751.
>   Now if the system was restarted, it will come up too.
>
>   You must change the subnet to your range.
>   And don´t forget to fix the bandwidth limit about 5% less than you want.
>
>   The abouve script set a 25KB/s in/out rate for each ip address of a subnet
> range.
>   This is the sum of all traffic for that client.
>   And so, if the client open more than one connection the limit will split
> between them.
>    It works even with p2p.

Do you have PF NAT port forwards in place?

I have noticed that this will break if PF RDR entries are in place.

Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to