LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 06-05-2008, 07:14 AM   #1
satish
Member
 
Registered: Jan 2006
Posts: 172

Rep: Reputation: 15
Bandwidth Shaping


i had Redhat 9 proxy server previous i am having 512 kbps bandwidth and now i had upgraded to 2 mbps.i am running below tc script for bandwidth shaping and it is for 512 kbps, can you modify below script to 2 mbps and show me the correct way,here is the script.

tc qdisc del dev eth0 root handle 1:0 htb

tc qdisc add dev eth0 root handle 1:0 htb

tc class add dev eth0 parent 1:0 classid 1:1 htb rate 512kbit

tc class add dev eth0 parent 1:1 classid 1:2 htb \rate 307kbit ceil 512kbit
tc class add dev eth0 parent 1:2 classid 1:3 htb \rate 204kbit ceil 512kbit

tc class add dev eth0 parent 1:1 classid 1:2 htb \rate 307kbit ceil 307kbit
tc class add dev eth0 parent 1:1 classid 1:3 htb \rate 204kbit ceil 204kbit

tc class add dev eth0 parent 1:2 classid 1:21 htb \rate 30kbit ceil 307kbit
tc class add dev eth0 parent 1:2 classid 1:22 htb \rate 61kbit ceil 307kbit
tc class add dev eth0 parent 1:2 classid 1:23 htb \rate 61kbit ceil 307kbit
tc class add dev eth0 parent 1:2 classid 1:24 htb \rate 153kbit ceil 307kbit

tc class add dev eth0 parent 1:3 classid 1:31 htb \rate 30kbit ceil 204kbit
tc class add dev eth0 parent 1:3 classid 1:32 htb \rate 61kbit ceil 204kbit
tc class add dev eth0 parent 1:3 classid 1:33 htb \rate 61kbit ceil 204kbit
tc class add dev eth0 parent 1:3 classid 1:34 htb \rate 51kbit ceil 204kbit

tc qdisc add dev eth0 parent 1:21 handle 210: pfifo limit 10
tc qdisc add dev eth0 parent 1:22 handle 220: pfifo limit 10
tc qdisc add dev eth0 parent 1:23 handle 230: pfifo limit 10
tc qdisc add dev eth0 parent 1:24 handle 240: pfifo limit 10
tc qdisc add dev eth0 parent 1:31 handle 310: pfifo limit 10
tc qdisc add dev eth0 parent 1:32 handle 320: pfifo limit 10
tc qdisc add dev eth0 parent 1:33 handle 330: pfifo limit 10
tc qdisc add dev eth0 parent 1:34 handle 340: pfifo limit 10

tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.1/26 match ip sport 23 0xfff flowid 1:21
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.1/26 match ip sport 80 0xfff flowid 1:22
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.1/26 match ip sport 20 0xfff flowid 1:23
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.1/26 match ip sport 21 0xfff flowid 1:23
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.1/26 flowid 1:24

tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.129/26 match ip sport 23 0xfff flowid 1:31
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.129/26 match ip sport 80 0xfff flowid 1:32
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.129/26 match ip sport 20 0xfff flowid 1:33
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.129/26 match ip sport 21 0xfff flowid 1:33
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 \match ip dst 192.168.129/26 flowid 1:34


is the script is correct,can you explain me,what the script does on my server since i am a newbie i cannot understand the script i had downloaded from site long time ago and does not remember what the script does.


Regards

Satish

Last edited by satish; 06-05-2008 at 07:16 AM. Reason: mistakes
 
Old 06-09-2008, 07:28 AM   #2
techleach
LQ Newbie
 
Registered: Jun 2008
Posts: 6

Rep: Reputation: 0
what actually you want in this script do you want to change any thing or need just explanation
 
Old 06-09-2008, 11:20 PM   #3
satish
Member
 
Registered: Jan 2006
Posts: 172

Original Poster
Rep: Reputation: 15
Bandwidth shaping

previous my bandwidth speed is 512 kbps and now we had upgraded to 2mbps speed, i got this script on the linux site which i couldn't remember. so please modify the script and give me the 2mbps script for bandwidth shaping on my local network and give me the explanation about the script.
as i am a newbie i don't know how to modify the script

Regards

Satish


Linux Version: Redhat 9
local network: 192.168.1.0/255
 
Old 06-15-2008, 05:53 AM   #4
techleach
LQ Newbie
 
Registered: Jun 2008
Posts: 6

Rep: Reputation: 0
Hi Satish

this three lines control the total bandwidth flow

tc qdisc del dev eth0 root handle 1:0 htb

tc qdisc add dev eth0 root handle 1:0 htb

tc class add dev eth0 parent 1:0 classid 1:1 htb rate 512kbit

SO You have to change the third line

tc class add dev eth0 parent 1:0 classid 1:1 htb rate 512kbit
to
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 2084kbit

to increse the total bandwidth and i have seen other rules also these are port based bandwidth rescriction not ip based

what you want port based or ip(host) based restriction
 
Old 06-16-2008, 11:34 PM   #5
satish
Member
 
Registered: Jan 2006
Posts: 172

Original Poster
Rep: Reputation: 15
Bandwidth Shaping

Thanks for your quick reply
Sir i want ip based bandwidth shaping,can you send me the rules please.as i am newbie i doesn't understand your short answers.please give me total shaping script just like i had given.

ip 192.168.1.3 to 192.168.1.20 Total 512 kbps
ip 192.168.1.21 to 192.168.1.255 Total 1.5 Mbps

Regards


satish
 
Old 06-17-2008, 05:54 AM   #6
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
You wanted an explanation.

my first impression:

scripts like this are supposed to shape traffic which is going OUT of your box - the bandwith values must fit your UPSTREAM bandwith.
It is not entirely clear from what you said that you now have 2 MBit upstream.
(DSL/ADSL-lines here for instance typically are called 2 MBit when there is a DOWNSTREAM of 2 MBit - but the UPSTREAM is just 256 kBit).

The script puts the traffic into different classes - based on certain criteria - here it is done with u32 matches (it looks inside the packets and matches 0xfff - whatever that is).
These classes get a certain bandwidth - an upper limit with "ceil" and a guaranteed minimum with "rate".

There is the first problem - the script uses bandwidths as low as 30kbit - this cannot be achieved as it is now - the first line would need to read:

Code:
tc qdisc add dev eth0 root handle 1:0 htb r2q 1
to achieve this.
Also there is no default class - packets not matched by the script do not get a certain (lower) priority - and are thus treated the same as everything else. Looks not very useful to me.

There is something more wrong with this script I think - classid 1:2 is used two times with different values.
Only one of these is needed, I think the first two lines are wrong and not needed.

Quote:
Code:
tc class add dev eth0 parent 1:1 classid 1:2 htb \rate 307kbit ceil 512kbit
tc class add dev eth0 parent 1:2 classid 1:3 htb \rate 204kbit ceil 512kbit

tc class add dev eth0 parent 1:1 classid 1:2 htb \rate 307kbit ceil 307kbit
tc class add dev eth0 parent 1:1 classid 1:3 htb \rate 204kbit ceil 204kbit
I'm not sure what these u32 matches actually match - besides the port - what should they do for you? What do you want them to do?

next:
For every "filter" line "prio 1" is used (everything gets the same high priority) - this does not make sense to me.
Especially combined with the fact that every class belonging to 1:2 and 1:3 has the same upper bandwidth (ceil).

I have written a few versions of shaping scripts - one of it is here: http://wiki.leipzig.freifunk.net/Traffic-Shaping
(have a version with english comments too)

It is most likely not what you want - I made it for my own special purpose.

If you describe what you want your script to do, I or someone else will be able to help you.

opinions?


Cheers

Last edited by jomen; 06-17-2008 at 06:05 AM.
 
  


Reply



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
Bandwidth usage/shaping void4ever Linux - Networking 3 06-12-2008 01:04 PM
Bandwidth shaping/throttling - How to? baltika_no_9 Linux - Networking 3 01-13-2007 07:14 AM
Bandwidth Shaping With Linux dev_rhce Linux - Networking 2 08-05-2005 01:24 PM
Bandwidth Shaping ketema Linux - Networking 0 06-23-2004 12:01 PM
bandwidth shaping - a little help chrisfirestar Linux - Networking 3 03-25-2004 12:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:41 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
Open Source Consulting | Domain Registration