View previous topic :: View next topic |
Author |
Message |
p3nguin Apprentice
Joined: 01 Jul 2003 Posts: 188 Location: ~/
|
Posted: Wed Sep 03, 2003 5:05 pm Post subject: traffic throttling |
|
|
I just got my router setup, im going to be installing shorewall on it later tonite. The next thing on my agenda is to setup some sort of traffic throttling so that one of the boxes on my internal lan will only be allowed a certain amount of upstream/downstream bandwidth for anything it does on the internet. I have searched for Qos and throttling, but mainly only found stuff on throttling apache or ftp.
even more specific if possible i would rather prefer to throttle only certain ports of the one particular box if possible. Otherwise capping all up/down would be fine. thanks |
|
Back to top |
|
|
Jeedo Apprentice
Joined: 02 May 2003 Posts: 202 Location: Akureyri, Iceland
|
Posted: Wed Sep 03, 2003 8:41 pm Post subject: |
|
|
i myself have searched loosly for sutch things on a kernel level bud had no luck.
FreeBSD has it though, not that i use it:) |
|
Back to top |
|
|
69link n00b
Joined: 18 Apr 2003 Posts: 53 Location: Sweden
|
Posted: Wed Sep 03, 2003 9:08 pm Post subject: |
|
|
Look at this thread: https://forums.gentoo.org/viewtopic.php?t=65826
That script is almost ready to go. Though you need some modules and stuff.
In Kernel:
#
# QoS and/or fair queueing
#
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=m
CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_CSZ=m
CONFIG_NET_SCH_PRIO=m
CONFIG_NET_SCH_RED=m
CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m
CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m
CONFIG_NET_SCH_DSMARK=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_QOS=y
CONFIG_NET_ESTIMATOR=y
CONFIG_NET_CLS=y
CONFIG_NET_CLS_TCINDEX=m
CONFIG_NET_CLS_ROUTE4=m
CONFIG_NET_CLS_ROUTE=y
CONFIG_NET_CLS_FW=m
CONFIG_NET_CLS_U32=m
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_POLICE=y
And then iproute (tc)
# emerge sys-apps/iproute
Probably you're gonna need the tc binary from: http://luxik.cdi.cz/~devik/qos/htb/
(htb3.6-020525.tgz) to be able to use HTB.
Then edit the script to your suiting and voila. You should have powerfull trafficshaping at your disposal. |
|
Back to top |
|
|
p3nguin Apprentice
Joined: 01 Jul 2003 Posts: 188 Location: ~/
|
Posted: Wed Sep 03, 2003 10:08 pm Post subject: |
|
|
I need to do some more reading as that script only makes some sense to me. I dont see anywhere in the script where there are rules only pertaining to a certain box which is what im looking for. thanks |
|
Back to top |
|
|
69link n00b
Joined: 18 Apr 2003 Posts: 53 Location: Sweden
|
Posted: Wed Sep 03, 2003 11:31 pm Post subject: |
|
|
Ah, here is an example:
In the script you will find a section like:
Code: |
# Set icmp as prioritized traffic
$IPTABLES -t mangle -A MANGLE_MARK -p icmp -j MARK --set-mark 20
$IPTABLES -t mangle -A MANGLE_MARK -p icmp -j RETURN
|
Create one like it with your parameters like:
Code: |
# Set puter as prioritized traffic
$IPTABLES -t mangle -A MANGLE_MARK -s 192.168.0.24/32 -j MARK --set-mark 20
$IPTABLES -t mangle -A MANGLE_MARK -s 192.168.0.24/32 -j RETURN
|
Which means that everything coming from source IP 192.168.0.24 will be marked as priority traffic. |
|
Back to top |
|
|
p3nguin Apprentice
Joined: 01 Jul 2003 Posts: 188 Location: ~/
|
Posted: Thu Sep 04, 2003 12:43 am Post subject: |
|
|
ah, ok...so i would define all the computers that I want to be "prioritized" there and then make the computer that i want capped to be on a lower priority thus capping him.
So set him to a -set mark 22 or something. Do those numbers, the 20,21,22 corresponde to the low,med and high UPLINK values?
if so im wondering how to deal with Downstream traffic as well. thanks, nice script btw. |
|
Back to top |
|
|
69link n00b
Joined: 18 Apr 2003 Posts: 53 Location: Sweden
|
Posted: Thu Sep 04, 2003 9:18 am Post subject: |
|
|
Yes, the -set mark 22 is just a number choosen to represent bulk in this case, mark 20 is high.
When you define the low, med, high & bulk. See them as precentage. Say you have 1mbit maximal output. Then the combined sum should'nt be less or higher than 1mbit.
Unfortunately the design of the script is not to give different computers different downloadspeeds, but to deal with traffic coming in and out of your internet interface.
I guess you could redesign the script a bit to put it on the internal interface. |
|
Back to top |
|
|
|