Re: [LARTC] tc-htb traffic shaping script
http://lartc.org/wondershaper/ On 5/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I can send you mine, it's a modified version of one I found somewhere on the net to be able to limit bandwith on a linux router. I did no cleaning up or anything #!/bin/bash # tc uses the following units when passed as a parameter. # kbps: Kilobytes per second # mbps: Megabytes per second # kbit: Kilobits per second # mbit: Megabits per second # bps: Bytes per second # Amounts of data can be specified in: # kb or k: Kilobytes # mb or m: Megabytes # mbit: Megabits # kbit: Kilobits # To get the byte figure from bits, divide the number by 8 bit # # # Name of the traffic control command. TC=/sbin/tc IPTABLES=/sbin/iptables # The network interface we're planning on limiting bandwidth. IF1=eth1.106# Interface IF2=eth0# Interface # Download limit (in mega bits) DNLD=100mbit # DOWNLOAD Limit # Upload limit (in mega bits) UPLD=100mbit # UPLOAD Limit # IP address of the machine we are controlling #IP=81.18.0.0/24#Host IP #IP=0.0.0.0/0 #Host IP # Filter options for limiting the intended interface. IN="$TC filter add dev $IF2 protocol ip parent 1:0 prio 1" OUT="$TC filter add dev $IF1 protocol ip parent 2:0 prio 1" start() { # All traffic originating from IF1 gets marked $IPTABLES -t mangle -D PREROUTING -i $IF1 -j MARK --set-mark 106 >/dev/null 2>&1 $IPTABLES -t mangle -A PREROUTING -i $IF1 -j MARK --set-mark 106 # INBOUND matches on fwmark 106 and gets shaped when it leaves the IF2 interface $TC qdisc add dev $IF2 root handle 1: htb default 30 $TC class add dev $IF2 parent 1: classid 1:1 htb rate $DNLD $IN handle 106 fw flowid 1:1 printf "\n" printf "Shaping traffic incoming on $IF1 ==> $IF2 to max. $DNLD" # OUTBOUND matches all traffic heading out IF1 gets shaped, no filter needed $TC qdisc add dev $IF1 root handle 2: htb default 1 $TC class add dev $IF1 parent 2: classid 2:1 htb rate $UPLD #$OUT u32 match ip src $IP flowid 2:1 printf "\n" printf "Shaping traffic incoming on $IF2 ==> $IF1 to max. $UPLD\n" # The first line creates the root qdisc, and the next line # creates a child qdiscs that respectively are used to shape download # and upload bandwidth. The third line defines a filter if required. } stop() { # Stop the bandwidth shaping. $TC qdisc del dev $IF1 root $TC qdisc del dev $IF2 root $IPTABLES -t mangle -D PREROUTING -i $IF1 -j MARK --set-mark 106 } restart() { # Self-explanatory. stop sleep 1 start } show() { # Display status of traffic control status. #$TC -s qdisc ls dev $IF1 $TC -s qdisc ls dev $IF2 } case "$1" in start) echo -n "Starting bandwidth shaping: " start echo "done" ;; stop) echo -n "Stopping bandwidth shaping: " stop echo "done" ;; restart) echo -n "Restarting bandwidth shaping: " restart echo "done" ;; show) echo "Bandwidth shaping status for $IF2:" show echo "" ;; *) pwd=$(pwd) echo "Usage: tc.bash {start|stop|restart|show}" ;; esac exit 0 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arman Sent: donderdag 24 mei 2007 12:46 To: lartc@mailman.ds9a.nl Subject: [LARTC] tc-htb traffic shaping script Hi, Is there any tested good HTB script for traffic shaping available like as that of CBQ available at. http://freshmeat.net/projects/cbq.init I am n new bie and need to work on htb. -- Regards, M Arman ___ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc -- Marco ___ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
RE: [LARTC] tc-htb traffic shaping script
I can send you mine, it's a modified version of one I found somewhere on the net to be able to limit bandwith on a linux router. I did no cleaning up or anything #!/bin/bash # tc uses the following units when passed as a parameter. # kbps: Kilobytes per second # mbps: Megabytes per second # kbit: Kilobits per second # mbit: Megabits per second # bps: Bytes per second # Amounts of data can be specified in: # kb or k: Kilobytes # mb or m: Megabytes # mbit: Megabits # kbit: Kilobits # To get the byte figure from bits, divide the number by 8 bit # # # Name of the traffic control command. TC=/sbin/tc IPTABLES=/sbin/iptables # The network interface we're planning on limiting bandwidth. IF1=eth1.106# Interface IF2=eth0# Interface # Download limit (in mega bits) DNLD=100mbit # DOWNLOAD Limit # Upload limit (in mega bits) UPLD=100mbit # UPLOAD Limit # IP address of the machine we are controlling #IP=81.18.0.0/24#Host IP #IP=0.0.0.0/0 #Host IP # Filter options for limiting the intended interface. IN="$TC filter add dev $IF2 protocol ip parent 1:0 prio 1" OUT="$TC filter add dev $IF1 protocol ip parent 2:0 prio 1" start() { # All traffic originating from IF1 gets marked $IPTABLES -t mangle -D PREROUTING -i $IF1 -j MARK --set-mark 106 >/dev/null 2>&1 $IPTABLES -t mangle -A PREROUTING -i $IF1 -j MARK --set-mark 106 # INBOUND matches on fwmark 106 and gets shaped when it leaves the IF2 interface $TC qdisc add dev $IF2 root handle 1: htb default 30 $TC class add dev $IF2 parent 1: classid 1:1 htb rate $DNLD $IN handle 106 fw flowid 1:1 printf "\n" printf "Shaping traffic incoming on $IF1 ==> $IF2 to max. $DNLD" # OUTBOUND matches all traffic heading out IF1 gets shaped, no filter needed $TC qdisc add dev $IF1 root handle 2: htb default 1 $TC class add dev $IF1 parent 2: classid 2:1 htb rate $UPLD #$OUT u32 match ip src $IP flowid 2:1 printf "\n" printf "Shaping traffic incoming on $IF2 ==> $IF1 to max. $UPLD\n" # The first line creates the root qdisc, and the next line # creates a child qdiscs that respectively are used to shape download # and upload bandwidth. The third line defines a filter if required. } stop() { # Stop the bandwidth shaping. $TC qdisc del dev $IF1 root $TC qdisc del dev $IF2 root $IPTABLES -t mangle -D PREROUTING -i $IF1 -j MARK --set-mark 106 } restart() { # Self-explanatory. stop sleep 1 start } show() { # Display status of traffic control status. #$TC -s qdisc ls dev $IF1 $TC -s qdisc ls dev $IF2 } case "$1" in start) echo -n "Starting bandwidth shaping: " start echo "done" ;; stop) echo -n "Stopping bandwidth shaping: " stop echo "done" ;; restart) echo -n "Restarting bandwidth shaping: " restart echo "done" ;; show) echo "Bandwidth shaping status for $IF2:" show echo "" ;; *) pwd=$(pwd) echo "Usage: tc.bash {start|stop|restart|show}" ;; esac exit 0 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arman Sent: donderdag 24 mei 2007 12:46 To: lartc@mailman.ds9a.nl Subject: [LARTC] tc-htb traffic shaping script Hi, Is there any tested good HTB script for traffic shaping available like as that of CBQ available at. http://freshmeat.net/projects/cbq.init I am n new bie and need to work on htb. -- Regards, M Arman ___ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
RE: [LARTC] TC HTB Traffic Shaping
I must give credit where credit is DUE THnks a LOT...this is a well PUT Together site, I couldn't ask for a better documentation about Traffic Shapping, I received way more infor, than I ask for... And your website, give me more insight about Traffic Shapping, even better than the HTB website.. Job well don Mr. Coene > -Original Message- > From: Stef Coene [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 22, 2002 16:45 > To: Reginald R. Richardson; [EMAIL PROTECTED] > Subject: Re: [LARTC] TC HTB Traffic Shaping > > > On Friday 22 November 2002 10:49, Reginald R. Richardson wrote: > > Hi guys, > > > > I'm new to TC HTB traffic shaping > > > > I installed it at my first try on my Bearing Leaf Router/Firewall > > > > I use the tc -s class show dev eth? To see my output > > All looks dandy and nice, but it's figures, of which at current > > momment looks like French to me, > > > > I would like to see exactly what these figures looks like > in a GRAPH > > style... > http://home.docum.org/stef.coene/qos/gui/rrd.html > > > I know I can use MRTG, I do have some litte expience in it.. But I > > need to figure out, what will be THE TARGET to caputre to > output via > > the VARIOIUS class from HTB > > > > If Mrtg, is not the best tool for this...can some one tell me of > > something very simple, not to much programming language to see, my > > output in a graph style.. > > > > What would be also very nice, if some on has a config file > for MRTG or > > what every other tool propose, if they can e-mail it to me, > for me to > > atleast get an ideal, how to build up the TARGET that should be > > monitored.. > More info on www.docum.org under "gui". > I use rrdtool to store and graph the data. Rrdtool is part > of the mrtg > package. > > Stef > > -- > > [EMAIL PROTECTED] > "Using Linux as bandwidth manager" > http://www.docum.org/ > #lartc @ irc.oftc.net > > ___ LARTC mailing list / [EMAIL PROTECTED] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Re: [LARTC] TC HTB Traffic Shaping
On Friday 22 November 2002 10:49, Reginald R. Richardson wrote: > Hi guys, > > I'm new to TC HTB traffic shaping > > I installed it at my first try on my Bearing Leaf Router/Firewall > > I use the tc -s class show dev eth? To see my output > All looks dandy and nice, but it's figures, of which at current momment > looks like French to me, > > I would like to see exactly what these figures looks like in a GRAPH > style... http://home.docum.org/stef.coene/qos/gui/rrd.html > I know I can use MRTG, I do have some litte expience in it.. > But I need to figure out, what will be THE TARGET to caputre to output > via the VARIOIUS class from HTB > > If Mrtg, is not the best tool for this...can some one tell me of > something very simple, not to much programming language to see, my > output in a graph style.. > > What would be also very nice, if some on has a config file for MRTG or > what every other tool propose, if they can e-mail it to me, for me to > atleast get an ideal, how to build up the TARGET that should be > monitored.. More info on www.docum.org under "gui". I use rrdtool to store and graph the data. Rrdtool is part of the mrtg package. Stef -- [EMAIL PROTECTED] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net ___ LARTC mailing list / [EMAIL PROTECTED] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/