All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vlad Mihai" <mihaivlad@web-profile.net>
To: lartc@vger.kernel.org
Subject: [LARTC] HTB services & IP's
Date: Tue, 19 Aug 2003 08:37:25 +0000	[thread overview]
Message-ID: <marc-lartc-106128234015935@msgid-missing> (raw)

Hello, 

I live in Romania where Internet is quite expensive for kids like me. 
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’t fall below 8kbit and can achieve 128kbit. 
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 ☺
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’s 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, 
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, 
(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. 

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


Thanking you in advance,
Vlad Mihai 



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=eth0
TC=/sbin/tc
FILTER="$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



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

                 reply	other threads:[~2003-08-19  8:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-106128234015935@msgid-missing \
    --to=mihaivlad@web-profile.net \
    --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.