LinuxQuestions.org
Review your favorite Linux distribution.
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 11-04-2011, 04:53 AM   #1
timmy_sunter
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Rep: Reputation: Disabled
traffic shapping on centos/redhat


Dear all linux guru,

need your guys help really bad.

this i my first post.
and i need help regarding traffic shapping to my web server.

so basicly i can't do this straight to my production server(redhat)
so i build my staging server on my vmware(centos)

what i want to achieve is:
ip range A (which may more than 1 range) limit max bandwidth to 1M
ip range B (which may more than 1 range) limit max bandwidth to 2M

i manage to limit the whole network interface for ip range A to max 1M using tc, but when it accessed by more than 1 user, the speed will be divided, which is wrong.

do you guys have any pointer with iptables?
i tried with mod_bandwidth -> no luck

please please please help me
thanks a lot!!!!
 
Old 11-04-2011, 05:42 AM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
http://lartc.org/howto/ explains the process quite well using iptables and tc.
 
Old 11-09-2011, 08:06 PM   #3
timmy_sunter
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Anyone can help me?

i configured 1 test file to config the TC and HTB but it's not working

#!/bin/sh
#
# Incoming traffic control
#
CT_IP1="10.1.1.0/24"
CT_IP2="192.168.1.0/24"
DEV=eth1
#
tc qdisc del dev $DEV root
#
tc qdisc add dev $DEV root handle 1: htb default 10
#
tc class add dev $DEV parent 1: classid 1:1 htb rate 10000mbit burst 15k
tc class add dev $DEV parent 1:1 classid 1:10 htb rate 2.5mbps ceil 10mbit burst 15k
tc class add dev $DEV parent 1:1 classid 1:20 htb rate 5mbps ceil 20mbit burst 15k
tc class add dev $DEV parent 1:1 classid 1:30 htb rate 30mbit ceil 30mbit burst 15k
#
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
#
if [ ! -z $CT_IP1 ]; then
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst "$CT_IP1" flowid 1:10
fi
if [ ! -z $CT_IP2 ]; then
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst "$CT_IP2" flowid 1:20
fi
#
echo;echo "tc configuration for $DEV:"
tc qdisc show dev $DEV
tc class show dev $DEV
tc filter show dev $DEV
#
# Outgoing traffic control
#
DEV=eth1
#
tc qdisc del dev $DEV root
#
tc qdisc add dev $DEV root handle 1: htb default 10
#
tc class add dev $DEV parent 1: classid 1:1 htb rate 10000mbit burst 15k
tc class add dev $DEV parent 1:1 classid 1:10 htb rate 5mbps ceil 10mbit burst 15k
tc class add dev $DEV parent 1:1 classid 1:20 htb rate 10mbps ceil 20mbit burst 15k
tc class add dev $DEV parent 1:1 classid 1:30 htb rate 30mbit ceil 30mbit burst 15k
#
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
#
if [ ! -z $CT_IP1 ]; then
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src "$CT_IP1" flowid 1:10
fi
if [ ! -z $CT_IP2 ]; then
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src "$CT_IP2" flowid 1:20
fi
#
echo;echo "tc configuration for $DEV:"
tc qdisc show dev $DEV
tc class show dev $DEV
tc filter show dev $DEV
 
  


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
Help with traffic shapping ALInux Linux - Networking 1 05-18-2009 03:46 AM
Traffic shapping question(s) capthookb Linux - Networking 2 06-08-2008 05:22 AM
Traffic rate limiting per IP on CentOS 5.0? Trionnis Linux - Networking 2 05-17-2007 07:54 AM
traffic shapping acidrop Linux - Networking 0 05-26-2005 11:06 AM
traffic shapping against msn/video marianop Linux - Networking 2 01-05-2004 03:22 PM

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

All times are GMT -5. The time now is 11:22 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