Re: [LARTC] herz the script that i have done.

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stef....;)

 Hats off to you. I am zapped as to how did you figure out the
"isolated" class wasn't working???.

 Anyway Stef, i am glad that you have detected something without my
telling you. Have changed the same and have restarted the server. Lets
see. Its night time here in Bombay, hence am playing around with the
production machine.

 Stef, I need to traffic shape for my 1000 odd users on the network. Is
there a way to do it by having static qdisc's /classes/filters inserted.

 Also, can i do them on the fly by having them login cia a SUID ROOT ph
page and then get web access and thus adding/deleting these qdisc's
/classes/filters on the fly???.

Trevor


On Sun, 2003-06-15 at 23:26, Stef Coene wrote:
> On Sunday 15 June 2003 01:46, Trevor Warren wrote:
> > Hello there,
> >
> >  Having made quite a lot of expensive mistakes i have finally clobbered
> > together a script for the users on my network.
> >
> >  Have a look at it and please suggest as to how can i limit bandwidth to
> > each ip on this network to about 64Kbits.
> You specify bandwidth 1mbit.  But that should be your real nic bandwidth.  So 
> 10mbit or 100mbit.  If you want to share the same 1Mbit between some classes, 
> you have to add 1 bounded class with rate = 1mbit to the root qdisc and add 
> the other classes to that class.
> Remove the isolated class, it's not working and can even distubr your setup.
> 
> Stef
-- 
( >-    GNU/LINUX, It's all about CHOICE      -< )
/~\    __  trevor@xxxxxxxxxxxxxxxxxxxxxx  __   /~\
|  \) /  Pre Sales Consultant - Red Hat     \ (/ |
|_|_  \    9820349221(M) | 22881326(O)      / _|_|
       \___________________________________/
#!/bin/bash
                                                                                                                                              
#####################################
#Deleting and setting up
#Root qdisc's
#####################################
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 100Mbit rate 1Mbit avpkt 1000 cell 8

#######################################
#Setting up top 2 qdiscs
#for initial packet classification
#######################################
# Exatt Rules
#######################################

tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 100Mbit rate 800kbit weight 80kbit allot 1514 cell 8 maxburst 20 avpkt 1000 bounded
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.10.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.10.0/24 classid 1:1
                                                                         
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.11.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.11.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.12.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.12.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.13.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.13.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.14.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.14.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.15.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.15.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.16.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.16.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.17.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.17.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.18.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.18.0/24 classid 1:1

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.19.0/24 classid 1:1
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.19.0/24 classid 1:1


##########################################
#Paradyne Rules
##########################################                                                                     
tc class add dev eth0 parent 1:0 classid 1:2 cbq bandwidth 100Mbit rate 200kbit weight 20kbit allot 1514 cell 8 maxburst 20 avpkt 1000 bounded
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.20.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.20.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.21.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.21.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.22.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.22.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.23.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.23.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.24.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.24.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.25.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.25.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.26.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.26.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.27.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.27.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.28.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.28.0/24 classid 1:2

tc filter add dev eth0 parent 1:0 protocol ip u32 match ip src 192.168.29.0/24 classid 1:2
tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dst 192.168.29.0/24 classid 1:2

                                                                                                                                              
#######################################
#Setting up top 10 qdiscs
#for initial Exatt packet classification
#######################################
tc class add dev eth0 parent 1:1 classid 1:3 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.10.0/24 classid 1:3
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.10.0/24 classid 1:3
                                                                                                                                              
tc class add dev eth0 parent 1:1 classid 1:4 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.11.0/24 classid 1:4
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.11.0/24 classid 1:4                                                                                
tc class add dev eth0 parent 1:1 classid 1:5 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.12.0/24 classid 1:5
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.12.0/24 classid 1:5
                                                                                                                                              
tc class add dev eth0 parent 1:1 classid 1:6 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.13.0/24 classid 1:6
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.13.0/24 classid 1:6
                                                                                                                                              
tc class add dev eth0 parent 1:1 classid 1:7 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated  
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.14.0/24 classid 1:7
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.14.0/24 classid 1:7
                                                                                                                                              
tc class add dev eth0 parent 1:1 classid 1:8 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.15.0/24 classid 1:8
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.15.0/24 classid 1:8

tc class add dev eth0 parent 1:1 classid 1:9 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated 
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.16.0/24 classid 1:9
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.16.0/24 classid 1:9
                                                                                                                                              
tc class add dev eth0 parent 1:1 classid 1:10 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.17.0/24 classid 1:10
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.17.0/24 classid 1:10
                                                                                                                                              
tc class add dev eth0 parent 1:1 classid 1:11 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated 
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.18.0/24 classid 1:11
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.18.0/24 classid 1:11
                                                                                                                                              
tc class add dev eth0 parent 1:1 classid 1:12 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded isolated 
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip src 192.168.19.0/24 classid 1:12
tc filter add dev eth0 parent 1:1 protocol ip u32 match ip dst 192.168.19.0/24 classid 1:12
                                 

######################################
#Setting up top 10 qdiscs
#for initial Paradyne packet classification
#######################################
tc class add dev eth0 parent 1:2 classid 1:13 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded 
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.20.0/24 classid 1:13
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.20.0/24 classid 1:13
                                                                                                             
tc class add dev eth0 parent 1:2 classid 1:14 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.21.0/24 classid 1:14
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.21.0/24 classid 1:14
                                                                                                                                             
tc class add dev eth0 parent 1:2 classid 1:15 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.22.0/24 classid 1:15
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.22.0/24 classid 1:15

tc class add dev eth0 parent 1:2 classid 1:16 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.23.0/24 classid 1:16
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.23.0/24 classid 1:16

tc class add dev eth0 parent 1:2 classid 1:17 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.24.0/24 classid 1:17
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.24.0/24 classid 1:17

tc class add dev eth0 parent 1:2 classid 1:18 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.25.0/24 classid 1:18
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.25.0/24 classid 1:18

tc class add dev eth0 parent 1:2 classid 1:19 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.26.0/24 classid 1:19
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.26.0/24 classid 1:19

tc class add dev eth0 parent 1:2 classid 1:20 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.27.0/24 classid 1:20
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.27.0/24 classid 1:20

tc class add dev eth0 parent 1:2 classid 1:21 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.28.0/24 classid 1:21
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.28.0/24 classid 1:21

tc class add dev eth0 parent 1:2 classid 1:22 cbq bandwidth 100Mbit rate 80Kbit allot 1514 cell 8 maxburst 20 avpkt 1000 weight 8Kbit bounded
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip src 192.168.29.0/24 classid 1:22
tc filter add dev eth0 parent 1:2 protocol ip u32 match ip dst 192.168.29.0/24 classid 1:22

                                                                                                                                              
#################################
# Start of Actual Filters
#################################
                                                                                                                                              


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux