Simple traffic shaping rule to limit bandwidth for clients

Hi All
I have a 256 kbit/s connection over a 192.168.0.0/24 network..the gateway is a natting linux server..I need some traffic shaping rules that limit the maximum available bandwidth for 192.168.0.1 -> 192.168.0.128 to 64 kbit/s and the rest to 32 kbits per second
Thx
LVL 19
http:// thevpn.guruAsked:
Who is Participating?
 
Kerem ERSOYPresidentCommented:
Hi,
A script such as this would do:

tc qdisc add dev eth0 root handle 1:0 htb
tc class add dev eth0 parent 1:1 classid 1:6 htb  rate 192kbit ceil 256kbit
tc filter add dev eth0 parent 1:0 protocol ip prio 5 u32 \
match ip src 192.168.0.1/25 0xffff \
match ip tos 0x10 0xff   \
flowid 1:6 police rate 64000bps burst 10240 mpu 0 action drop/continue  
tc filter add dev eth0 parent 1:0 protocol ip prio 5 u32 \
match ip src 192.168.0.128/25 0xffff \
match ip tos 0x10 0xff   \
flowid 1:6 police rate 32000bps burst 10240 mpu 0 action drop/continue
0
 
Kerem ERSOYPresidentCommented:
As a prerequisite you need iproute2 package and certain settings in your kernel though several up-to-date distros include iproute2:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.