LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
 
Search this Thread
Old 09-26-2003, 12:40 AM   #1
Tyco
LQ Newbie
 
Registered: Jun 2003
Posts: 10

Rep: Reputation: 0
Traffic shaping (Prioritizing by port)


I would like to do what is hopefully something simple.

I want to configure a spare computer as a basic router and basic firewall, not uber-security or anything like that, but with one hitch: For all the outgoing traffic, I want to be able to give a few ports a higher priority than everything else (2 priority levels): HTTP, telnet, mail, and maybe a couple others, so that if an HTTP request shows up while I'm kazaaing or whatever, the HTTP gets priority and goes through, instead of being choked by kazaa (I'm just using kazaa as an example, I'd never actually USE that horrible piece of adware).

So what I need help with is getting two network adapters going, the router working, and the shaping in effect.... sorry, I'm still kind of a linux newbie. From the bit that I've been able to find on the subject, it seems that Red Hat is the best distro for having these kind of tools.

Anyway, any help is VERY much appreciated. Thanks!
-Tyco
 
Old 10-06-2003, 10:58 PM   #2
td_miles
Member
 
Registered: Sep 2003
Location: Australia
Distribution: RedHat
Posts: 51

Rep: Reputation: 15
try:

http://www.ibiblio.org/pub/Linux/doc...ing-HOWTO.html
 
Old 10-07-2003, 04:25 PM   #3
dexteroo
Member
 
Registered: Sep 2003
Location: Nigeria
Distribution: CentOS 4.3
Posts: 37

Rep: Reputation: 15
I think you would be fine using HTB on RH, and 9.0 has it all compiled in, so no patching to do. Visit http:www.docum.org for lots of info and links on how to setup classes and do all kinds of shaping. Let me know if you have any problems, cause I have several such setups in place.

Dex.
 
Old 02-10-2004, 06:46 PM   #4
NightShade737
LQ Newbie
 
Registered: Jun 2003
Location: Worcs, UK
Distribution: Gentoo
Posts: 29

Rep: Reputation: 15
I am also trying to do this, but it seems to be ignoring me.

The script is this -

class Outgoing {
bandwidth 0;
limit 230;
burst 2;
priority 1;

Client LAN {
bandwidth 60;
limit 230;
burst 2;
priority 1;
src { 192.168.0.0/16 ;};

};

Client Apache {
bandwidth 20;
limit 180;
burst 2;
priority 2;
src { 127.0.0.1/32 80 ;};
};


and it shows up like this:

Outgoing 0.23 0 0 230
LAN 0.00 0 60 230
Apache 0.00 0 20 180
_DEFAULT_ 0.28 0 0 0


But even when traffic is going through apache, it only ever shows up as Outgoing or Default, infact, LAN and Apache never do anything.
What am I missing?
 
Old 02-11-2004, 12:07 AM   #5
dexteroo
Member
 
Registered: Sep 2003
Location: Nigeria
Distribution: CentOS 4.3
Posts: 37

Rep: Reputation: 15
I'm not quite clear what your script is supposed to be doing, I have had experience using HTB classification and I know of a htb.init script which is supposed to simplify implementation, however I have never tried it. Your script however doesn't seem to follow the syntax of either.

If you made yourself a bit clearer, maybe somemore information, I might be able to be of some help ;-)
 
Old 02-11-2004, 03:56 AM   #6
NightShade737
LQ Newbie
 
Registered: Jun 2003
Location: Worcs, UK
Distribution: Gentoo
Posts: 29

Rep: Reputation: 15
I am using the HTB tools which are q_parser and q_show where you pass the network name and conf file, and it does a proper tc script from that (basically like a higher level interpreter).

What the script is supposed to be doing is taking everything that comes from localhosts port 80, and limiting the speed it goes out at, but something seems to be wrong and it doesn't seem to pick anything up.

If I wanted to limit the speed of apache2 with tc, is this the best way to do it? (no mods are available for apache2 internally).

I.e., when I give q_parser that script, it outputs this -

#!/bin/sh


DEV=eth0
TC=/sbin/tc
U32="filter add dev $DEV protocol ip parent 1:0 prio 1 u32"


echo Delete previous root qdisc
$TC qdisc del dev $DEV root >/dev/null 2>&1

echo Add root qdisc
$TC qdisc add dev $DEV root handle 1: htb default 10
echo Add root class
$TC class add dev $DEV parent 1: classid 1:1 htb rate 0kbps ceil 28kbps burst 2k
echo Add default class
$TC class add dev $DEV parent 1:1 classid 1:0x10 htb rate 0kbps ceil 0kbps burst 2k
$TC qdisc add dev $DEV parent 1:0x10 handle 0x10: pfifo limit 5

echo Add class Outgoing
$TC class add dev $DEV parent 1:1 classid 1:0x20 htb rate 0kbps ceil 28kbps burst 2k prio 1
echo Add client LAN
$TC class add dev $DEV parent 1:0x20 classid 1:0x21 htb rate 7kbps ceil 28kbps burst 2k prio 1
$TC ${U32} match ip src 192.168.0.0/16 flowid 1:0x21
$TC qdisc add dev $DEV parent 1:0x21 handle 0x21: pfifo limit 5
echo Add client Apache
$TC class add dev $DEV parent 1:0x20 classid 1:0x22 htb rate 2kbps ceil 22kbps burst 2k prio 2
$TC ${U32} match ip src 127.0.0.1/32 match ip sport 80 0xffff flowid 1:0x22
$TC qdisc add dev $DEV parent 1:0x22 handle 0x22: pfifo limit 5


Last edited by NightShade737; 02-11-2004 at 03:57 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 12:09 AM
Traffic Shaping SchwipSchwap Linux - Newbie 2 10-23-2008 12:42 PM
Traffic shaping shy Linux - Networking 2 11-30-2004 09:51 AM
Traffic Shaping nemesisza Linux - Networking 1 03-21-2004 05:52 PM
Traffic Shaping ?? DocKane Linux - Networking 2 08-24-2001 09:32 AM


All times are GMT -5. The time now is 05:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration