[LARTC] HTB services & IP's

Linux Advanced Routing and Traffic Control

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

 



Hello,=20

I live in Romania where Internet is quite expensive for kids like me.=20
We have managed to buy a 8/128 kbit (kilo bit) not kbps (kilo bytes).
It means that my ISP guarantees that the traffic won=E2=80=99t fall =
below 8kbit and can achieve 128kbit.=20
I have a "SlackWare" Linux box that is used for NAT.
There are about 10 clients that will share the bandwidth.

I am very new to HTB and tc, so the answer for this question is a piece =
of cake for u =E2=98=BA
I read an excellent article here: =
http://lartc.org/howto/lartc.cookbook.fullnat.intro.html

That script is somehow "service-focused", meaning that it filters the =
traffic based on services and ports.
Mine is "IP-focused", meaning that it filters the traffic based on =
IP=E2=80=99s in my LAN.

What I want is to "combine" these to types of scripts and have equal =
sharing among my clients and also prioritizing the traffic,=20
as the article explains, based on services. What I had in mind so far =
was to create some leaf classes for each of my 8 clients,=20
(I split the band in 8 pieces and after that I prioritize services on =
each of these pieces).
But this would make the script huge.=20

I don=E2=80=99t know what to do=E2=80=A6 How can I mark (filter) the =
packets (with IPTables mangle) based on IP=E2=80=99s but also on =
services they need?


Thanking you in advance,
Vlad Mihai=20



P.S.
BTW, I observed that the filtering works only for downloads, and is =
ignored for uploads....





Here is my script:

#!/bin/sh

LAN_IFACE=3Deth0
TC=3D/sbin/tc
FILTER=3D"$TC filter add dev $LAN_IFACE protocol ip parent 1:0 prio 1 =
u32 match ip"


$TC qdisc del dev $LAN_IFACE root >/dev/null 2>&1                        =
                       # Delete previous root qdisc

$TC qdisc add dev $LAN_IFACE root handle 1: htb default 30               =
                       # root qdisc
$TC class add dev $LAN_IFACE parent 1: classid 1:1 htb rate 128kbit ceil =
128kbit burst 30k      # root class

$TC class add dev $LAN_IFACE parent 1:1 classid 1:30 htb rate 1kbit ceil =
128kbit burst 30k      # default class
$TC qdisc add dev $LAN_IFACE parent 1:30 handle 30: sfq perturb 10       =
                       # dafault class queuing discipline




$TC class add dev $LAN_IFACE parent 1:1 classid 1:11 htb rate 8kbit ceil =
128kbit burst 30k     # mihai.tarnita.net
$FILTER dst 192.168.0.121 flowid 1:11
$TC qdisc add dev $LAN_IFACE parent 1:11 handle 11: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:12 htb rate 8kbit ceil =
128kbit burst 30k     # horea.tarnita.net
$FILTER dst 192.168.0.122 flowid 1:12
$TC qdisc add dev $LAN_IFACE parent 1:12 handle 12: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:13 htb rate 8kbit ceil =
128kbit burst 30k     # sergiu.tarnita.net
$FILTER dst 192.168.0.123 flowid 1:13
$TC qdisc add dev $LAN_IFACE parent 1:13 handle 13: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:14 htb rate 8kbit ceil =
128kbit burst 30k      # damian.tarnita.net
$FILTER dst 192.168.0.124 flowid 1:14
$TC qdisc add dev $LAN_IFACE parent 1:14 handle 14: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:15 htb rate 8kbit ceil =
128kbit burst 30k     # victor.tarnita.net
$FILTER dst 192.168.0.141 flowid 1:15
$TC qdisc add dev $LAN_IFACE parent 1:15 handle 15: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:16 htb rate 8kbit ceil =
128kbit burst 30k     # liana.tarnita.net
$FILTER dst 192.168.0.144 flowid 1:16
$TC qdisc add dev $LAN_IFACE parent 1:16 handle 16: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:17 htb rate 8kbit ceil =
128kbit burst 30k     # adi.tarnita.net
$FILTER dst 192.168.0.145 flowid 1:17
$TC qdisc add dev $LAN_IFACE parent 1:17 handle 17: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:18 htb rate 8kbit ceil =
128kbit burst 30k      # kiowa.tarnita.net
$FILTER dst 192.168.0.161 flowid 1:18
$TC qdisc add dev $LAN_IFACE parent 1:18 handle 18: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:19 htb rate 8kbit ceil =
128kbit burst 30k      # boby.tarnita.net
$FILTER dst 192.168.0.181 flowid 1:19
$TC qdisc add dev $LAN_IFACE parent 1:19 handle 19: sfq perturb 10

$TC class add dev $LAN_IFACE parent 1:1 classid 1:20 htb rate 8kbit ceil =
128kbit burst 30k      # delia.tarnita.net
$FILTER dst 192.168.0.185 flowid 1:20
$TC qdisc add dev $LAN_IFACE parent 1:20 handle 20: sfq perturb 10





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