Re: Questin regarding HTB

Linux Advanced Routing and Traffic Control

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

 



Yes sure here they are:
The first one that i have received 2day and does not work almost at all:

#!/bin/bash

ETH_IN="eth1"
ETH_OUT="eth0"
BANDA_TOTALA="2Mbit"
# pentru neclasificati ar trebui sa fie banda minima  - 1k  - aici ar trebui
sa ajunga trafic necunoscut,
# care nu e organizat in shape-uri
BANDA_NECLASIFICATI="8kbit"

#Shape generale
/sbin/tc qdisc del dev $ETH_IN root
/sbin/tc qdisc del dev $ETH_OUT root
/sbin/tc qdisc add dev $ETH_IN root handle 1 htb default 10 r2q 2
/sbin/tc qdisc add dev $ETH_OUT root handle 1 htb default 10 r2q 2
/sbin/tc class add dev $ETH_IN parent 1: classid 1:2 htb rate $BANDA_TOTALA
/sbin/tc class add dev $ETH_OUT parent 1: classid 1:2 htb rate $BANDA_TOTALA
/sbin/tc class add dev $ETH_IN parent 1:2 classid 1:10 htb rate
$BANDA_NECLASIFICATI prio 4
/sbin/tc class add dev $ETH_OUT parent 1:2 classid 1:10 htb rate
$BANDA_NECLASIFICATI prio 4

#Shape client 1 - IP 194.126.178.1 si 194.126.179.0/28
/sbin/tc class add dev $ETH_IN parent 1:2 classid 1:101 htb rate 1024kbit
ceil 1100kbit quantum 65000 prio 4 burst 10k
/sbin/tc class add dev $ETH_OUT parent 1:2 classid 1:101 htb rate 1024kbit
ceil 1100kbit quantum 65000 prio 4 burst 10k
/sbin/tc filter add dev $ETH_IN parent 1:0 protocol ip prio 100 u32 match ip
dst 194.126.178.1/32 classid 1:101
/sbin/tc filter add dev $ETH_OUT parent 1:0 protocol ip prio 100 u32 match
ip src 194.126.178.1/32 classid 1:101
/sbin/tc filter add dev $ETH_IN parent 1:0 protocol ip prio 100 u32 match ip
dst 194.126.179.0/28 classid 1:101
/sbin/tc filter add dev $ETH_OUT parent 1:0 protocol ip prio 100 u32 match
ip src 194.126.179.0/28 classid 1:101


#Shapeclient 2 - IP 194.126.178.128/25
#/sbin/tc class add dev $ETH_IN parent 1:2 classid 1:102 htb rate 15Mbit
ceil 15Mbit quantum 65000 prio 4 burst 10k
#/sbin/tc class add dev $ETH_OUT parent 1:2 classid 1:102 htb rate 20Mbit
ceil 30Mbit quantum 65000 prio 4 burst 10k
#/sbin/tc filter add dev $ETH_IN parent 1:0 protocol ip prio 100 u32 match
ip dst 194.126.178.128/25 classid 1:102
#/sbin/tc filter add dev $ETH_OUT parent 1:0 protocol ip prio 100 u32 match
ip src 194.126.178.128/25 classid 1:102

They`ve told me that this one limits band only for extern but is FALSE it
limits ALL the bandwidth :(


The other one it works but also on entire bandwidth though i can make
guarantees individually. here is a pice of it (they are 512 IPs so .. :) )

#!/bin/sh
# kbps = kilobytes and kbit = kilobits
# 1kbps=8kbit. Don't forget it !

I="/sbin/iptables"
TC="/sbin/tc"

echo "";echo -e "`date +'%b %d %k:%M:%S'` \033[40m\033[1;32mStarting Traffic
Shaper Script...\033[0m"

#Reset everything to a known state (cleared)
$TC qdisc del dev eth0 root 2>/dev/null
$TC qdisc del dev eth0 ingress 2>/dev/null
$TC qdisc del dev eth1 root 2>/dev/null
$TC qdisc del dev eth1 ingress 2>/dev/null

$I -F -t mangle
$I -X -t mangle
$I -Z -t mangle

/root/mod.probe

#Setting rules
#-------------
#default class
$TC qdisc add dev eth0 root handle 1: htb
$TC qdisc add dev eth1 root handle 1:0 htb default 10

#root class
$TC class add dev eth0 parent 1: classid 1:1 htb rate 100Mbit
$TC class add dev eth1 parent 1: classid 1:1 htb rate 100Mbit

#trafic total server --> internet - upload
$TC class add dev eth0 parent 1:1 classid 1:10 htb rate 50Mbit prio 2
$TC qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
$TC class add dev eth1 parent 1:1 classid 1:10 htb rate 50Mbit prio 2
$TC qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10

#trafic LAN
$TC class add dev eth1 parent 1:1 classid 1:10 htb rate 10Mbit ceil 50Mbit
$TC qdisc add dev eth1 parent 1:10 handle 1: sfq perturb 10
$TC filter add dev eth1 parent 1: protocol ip handle 1 fw classid 1:10

#trafic forward ip_local --> server --> internet - upload
$TC class add dev eth0 parent 1:1 classid 1:10 htb rate 50Mbit prio 2
$TC qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
$TC class add dev eth1 parent 1:1 classid 1:10 htb rate 50Mbit prio 2
$TC qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10

#trafic LAN
$TC class add dev eth1 parent 1:1 classid 1:10 htb rate 10Mbit ceil 50Mbit
$TC qdisc add dev eth1 parent 1:10 handle 1: sfq perturb 10
$TC filter add dev eth1 parent 1: protocol ip handle 1 fw classid 1:10

#trafic forward ip_local --> server --> internet - upload
$TC class add dev eth0 parent 1:1 classid 1:20 htb rate 2Mbit ceil 20Mbit
$TC class add dev eth0 parent 1:20 classid 1:200 htb rate 2Mbit ceil 20Mbit
prio 2

#trafic forward internet --> server --> ip_local - download
$TC class add dev eth1 parent 1:1 classid 1:20 htb rate 9Mbit ceil 80Mbit
$TC qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10
$TC class add dev eth1 parent 1:20 classid 1:200 htb rate 9Mbit ceil 80Mbit
prio 2


echo "";echo -e "`date +'%b %d %k:%M:%S'` \033[40m\033[1;32mLimitare Clasa
194.126.178.0/24\033[0m"
#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||
#                                           194.126.178.2
#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||
$TC class add dev eth1 parent 1:200 classid 1:202 htb rate 32kbit ceil 9Mbit
prio 2                             #download
$TC qdisc add dev eth1 parent 1:202 handle 202: sfq perturb 6
#download
$I -t mangle -A FORWARD -o eth1 -d 194.126.178.2 -j MARK --set-mark 2
#download
$TC filter add dev eth1 parent 1: prio 2 protocol ip handle 2 fw flowid
1:202                                   #download
#---------------------------------------------------------------------------
---------------------
$TC class add dev eth0 parent 1:200 classid 1:202 htb rate 32kbit ceil 6Mbit
prio 2                             #upload
$TC qdisc add dev eth0 parent 1:202 handle 202: sfq perturb 6
#upload
$I -t mangle -A FORWARD -o eth0 -s 194.126.178.2 -j MARK --set-mark 602
#upload
$TC filter add dev eth0 parent 1: prio 2 protocol ip handle 602 fw flowid
1:202                                 #upload


#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||
#                                           194.126.178.3
#|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||
$TC class add dev eth1 parent 1:200 classid 1:203 htb rate 128kbit ceil
9Mbit prio 2                            #download
$TC qdisc add dev eth1 parent 1:203 handle 203: sfq perturb 6
#download
$I -t mangle -A FORWARD -o eth1 -d 194.126.178.3 -j MARK --set-mark 3
#download
$TC filter add dev eth1 parent 1: prio 2 protocol ip handle 3 fw flowid
1:203                                   #download
#---------------------------------------------------------------------------
---------------------
$TC class add dev eth0 parent 1:200 classid 1:203 htb rate 10Mbit ceil
16Mbit prio 2                            #upload
$TC qdisc add dev eth0 parent 1:203 handle 203: sfq perturb 6
#upload
$I -t mangle -A FORWARD -o eth0 -s 194.126.178.3 -j MARK --set-mark 603
#upload
$TC filter add dev eth0 parent 1: prio 2 protocol ip handle 603 fw flowid
1:203

on this one i can give what value i want for rate and ceil and works BUT
it`s using iptables and mangle and also its effect is on entire bandwidth

So...??


----- Original Message -----
From: "Kiruthika Selvamani" <
kiruthika.selvamani@xxxxxxxxx>
To: "Vlad LUPESCU" <
vlad.lupescu@xxxxxxxxxxxx>
Sent: Tuesday, June 28, 2005 4:48 PM
Subject: Re: Question regarding HTB


Can you post the HTB scripts you are using - that way it will be
easier to understand what you are trying to do
On 6/28/05, Vlad LUPESCU <
vlad.lupescu@xxxxxxxxxxxx> wrote:
>
> Ok,
> So I am from Romania where we have this tiny problem. The IP clases are
> split in 2: metropolitan and extern (worldwide). We have 2 types of
> guaranteed band: metro and extern. Now.. the link comes into my gw. I have
> an IP which my ISP gave it to me which is eth0. I have 2 other PI clasess
> 194.126.178.0/23. What I want to do is this: make a HTB script which can
> limit the bandwidth on each PI individual (ex. on 178.7 i want to have
> 256kbits extern with 2Mbits metro, on 179.3 i want 128kb with 8mb and so
> on). All of HTB scripts that my friends gave it to me can limit ALL the
> bandwidth (extern+metro) and I don`t want that. I have all metro routes in
a
> file called 'clases' if this is important. If anyone can help me pls do
i`m
> desperate!!!!!!!
>
> 10q
> Vlad
> _______________________________________________
> LARTC mailing list
>
LARTC@xxxxxxxxxxxxxxx
> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
>
>
>

-----------------------------------------
Vlad Lupescu
 
Network Admin
S.C. Actual BVT S.R.L.
www.actualbvt.ro
-----------------------------------------
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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