Looking for good WS script

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi i make this script (Wonder Shaper modify) to accelerate www,Counter
strike and some other ports.

Can anybody tell me what you thinks about it?

- My problem is with http downloads. The priority is for Counter Strike but
when somebody start
downloading a file from http the Ping Lag get up to 500.
- Something more, i can prioritize the DNS from the server (i am using a
dnscache).

Using Leaf Bering 1.2 (kernel 2.4.20)

Well here is, see it.

#!/bin/bash
# Wonder Shaper ADSL

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

DOWNLINK=440
UPLINK=110
UPLINK90=100
UPLINK80=90
DEV=ppp0

##########################################################################
# Clean qdisc

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

##########################################################################
# Root class

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

##########################################################################
# Children class

# Max priority for ACK and others
tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \
   burst 2k prio 1

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

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

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

##########################################################################
# 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

##########################################################################
# Filters

##########################################################################
  # Ports

        # 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 \
        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

##########################################################################
  # Per terminal

#       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 (i don't use it)
        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

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

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux