All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sebastián Aresca" <sebastian@aresca.com.ar>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Looking for a good htb traffic shaping script to prioritize incoming traffic
Date: Sat, 09 Aug 2003 04:27:27 +0000	[thread overview]
Message-ID: <marc-lartc-106040336709066@msgid-missing> (raw)
In-Reply-To: <marc-lartc-106035941906425@msgid-missing>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1252", Size: 9962 bytes --]

Here the scrip of wonder shaper ... i modified it to
prioritize Counter Strike, ACK, DNS and HTTP.
The same with telnet.
This is used for ppp0 uptreams and the other the htb script for eth0 to
priritize
download. This is working for now, is anybody have to modified something
please tell me.

Best Regards.

Sebastian A. Aresca

The other ... the message are in spanish =(.


     ------------------------------------------ 
Outcoming ------------------------------------------ 

#!/bin/bash
# Wonder Shaper ADSL

##########################################################################
# RATES

DOWNLINKD0
UPLINK\x110
UPLINK90\x100
UPLINK80
DEV=ppp0

##########################################################################
# BORRAS COLAS

tc qdisc del dev $DEV root    2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null

iptables -t mangle -F PREROUTING

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

##########################################################################
# CLASE PRINCIPAL

tc qdisc add dev $DEV root handle 1: htb default 30
tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k

##########################################################################
# SUB CLASES

# Maxima Prioridad
tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
   burst 2k prio 1

# Counter

tc class add dev $DEV parent 1:1 classid 1:15 htb rate ${UPLINK90}kbit \
   burst 2k prio 3

# Clase puertos
tc class add dev $DEV parent 1:1 classid 1:20 htb rate ${UPLINK80}kbit \
   burst 2k prio 5

# Clase terminales
tc class add dev $DEV parent 1:1 classid 1:30 htb rate ${UPLINK80}kbit \
   burst 2k prio 7

##########################################################################
# COLAS SFQ

tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:15 handle 15: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10

##########################################################################
# FILTROS

##########################################################################
  # Por puerto
        # ICMP (ping)
        tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
        match ip protocol 1 0xff flowid 1:10

        # ACK
        tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \
        match ip protocol 6 0xff \
        match u8 0x05 0x0f at 0 \
        match u16 0x0000 0xffc0 at 2 \
        match u8 0x10 0xff at 33 \
        match u8 0x10 0xff at 33 \
        flowid 1:10

        # Puerto Telnet 23
        tc filter add dev $DEV parent 1: protocol ip prio 12 u32 \
        match ip dport 23 0xffff flowid 1:10

        # DNS
        #tc filter add dev $DEV parent 1: protocol ip prio 11 u32 \
        #match ip sport 53 0xffff \
        #match ip protocol 17 0xff \
        #flowid 1:10

        # Puerto 80
        tc filter add dev $DEV parent 1: protocol ip prio 20 u32 \
        match ip dport 80 0xffff flowid 1:20

        # Puerto Counter 2701x

        tc filter add dev ppp0 parent 1: protocol ip prio 15 handle 9 fw
flowid 1:15

        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27010 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27011 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27012 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27013 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27014 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27015 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27016 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27017 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27018 \
                 -j MARK --set-mark 9
        iptables -t mangle -A PREROUTING -i eth0 -p udp --dport 27019 \
                 -j MARK --set-mark 9

##########################################################################
  # By machine

        # wksWindowsXP
       tc filter add dev $DEV parent 1: protocol ip prio 20 \
       handle 4 fw flowid 1:30
       iptables -t mangle -A PREROUTING -s 192.168.0.4 \
       -j MARK --set-mark 4

##########################################################################
# General        tc filter add dev $DEV parent 1: protocol ip prio 20 u32 \
        match ip dst 0.0.0.0/0 flowid 1:30

##########################################################################
# DOWNLOAD

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

     ------------------------------------------ 
Incoming ------------------------------------------ 
#! /bin/sh
#

############################################################################
#
# Parametros
#
############################################################################
#

# r2q = rate_mas_bajo / 1500
#R2Q\x15

# Ancho de banda Total
BWVKbps

# Definicion de clase padre

tc qdisc del dev eth0 root
iptables -t mangle -F POSTROUTING

if [ "$1" = "stop" ]
then
        echo 'Stop'
        exit
fi

tc qdisc add dev eth0 root handle 1: htb default 19

############################################################################
#
# Clases
#
############################################################################
#

tc class add dev eth0 parent 1: classid 1:1 htb rate $BW ceil $BW
tc class add dev eth0 parent 1:1 classid 1:17 htb rate 36kbps burst 2k ceil
$BW    prio 1
tc class add dev eth0 parent 1:1 classid 1:18 htb rate 10kbps burst 2k ceil
$BW    prio 2
tc class add dev eth0 parent 1:1 classid 1:19 htb rate 10kbps burst 2k ceil
$BW    prio 7

tc qdisc add dev eth0 parent 1:17 handle 17: sfq perturb 10
tc qdisc add dev eth0 parent 1:18 handle 18: sfq perturb 10
tc qdisc add dev eth0 parent 1:19 handle 19: sfq perturb 10

############################################################################
#
# Filtros
#
############################################################################
#

# Con IPTABLES

tc filter add dev eth0 parent 1: protocol ip prio 1 handle 1 fw flowid 1:17
tc filter add dev eth0 parent 1: protocol ip prio 10 handle 9 fw flowid 1:17
tc filter add dev eth0 parent 1: protocol ip prio 30 handle 8 fw flowid 1:18
tc filter add dev eth0 parent 1: protocol ip prio 20 handle 9 fw flowid 1:19

# Por puesto

#iptables -t mangle -A POSTROUTING -o eth0 -d 192.168.0.1 \
#        -j MARK --set-mark 1

# POR PUERTO

# Ping

iptables -t mangle -A POSTROUTING -o eth0 -p icmp \
        -j MARK --set-mark 1

# Puerto 80

iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 80 \
        -j MARK --set-mark 8

# Puertos del Counter

iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27010 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27011 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27012 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27013 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27014 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27015 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p udp --sport 27016 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27017 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27018 \
        -j MARK --set-mark 9
iptables -t mangle -A POSTROUTING -o eth0 -p tcp --sport 27019 \
        -j MARK --set-mark 9

############################################################################
#
# Respuesta
#
############################################################################
#

#echo 'Cola:'
#tc qdisc show dev eth0
#echo ''
#echo ''
#echo 'Clases:'
#tc class show dev eth0
#echo ''
#echo ''
echo 'Filtros:'
tc filter show dev eth0







> I am looking for a good htb traffic shaping script to prioritize incoming
> traffic over outgoing traffic for my machine.  I have a 100mbit line, ftp
> up, backup data comming in, but whenever mirrors starts grabbing it they
use
> all the traffic and the backup data comming in (the important data) drops
to
> like 300kb/sec.  I was thinking some script doing
>
> sleep 60
> [if downstream > 1mb/sec, limit upstream -1mb/sec] or something.
>
> Also, the machine isnt the best box, so once it gets up to about 10MB/s
> transfer the CPU is running at 100% and cant go much faster, so getting
cpu
> usage low and maybe have it a little less accurate is preferable.
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?pageþatures/junkmail
>
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

      reply	other threads:[~2003-08-09  4:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-08 16:11 [LARTC] Looking for a good htb traffic shaping script to prioritize incoming traffic John M.
2003-08-09  4:27 ` Sebastián Aresca [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-106040336709066@msgid-missing \
    --to=sebastian@aresca.com.ar \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.