All of lore.kernel.org
 help / color / mirror / Atom feed
From: choros <jorge@inway.cz>
To: lartc@vger.kernel.org
Subject: [LARTC] imq + htb
Date: Sat, 01 Oct 2005 00:58:53 +0000	[thread overview]
Message-ID: <433DDF4D.4050306@inway.cz> (raw)

Hi, i am running imq + htb on my router , the situation is like this

eth0 = uplink to my provider
eth1 = 1st customer
eth2 = 2nd customer
eth3 = 3th customer

eth0 has limit 512 and i want to share this between eth1 eth2 and eth3 , 
but not working , this is the script i used,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin

iptables -t mangle -F  2>/dev/null
iptables -t mangle -X  2>/dev/null
iptables -t mangle -N markov
iptables -t mangle -I PREROUTING -j markov
iptables -t mangle -N markov2
iptables -t mangle -I POSTROUTING -j markov2

tc qdisc del dev imq0 root >/dev/null 2>&1
tc qdisc del dev imq1 root >/dev/null 2>&1

#bring up the imq0
ip link set dev imq0 up

#marking of  incoming from eth1,eth2,eth3
iptables -t mangle -A markov -i eth1 -j MARK --set-mark 1
iptables -t mangle -A markov -i eth2 -j MARK --set-mark 2
iptables -t mangle -A markov -i eth3 -j MARK --set-mark 3

#forward it to imq0
iptables -t mangle -A PREROUTING -i eth1 -j IMQ --todev 0
iptables -t mangle -A PREROUTING -i eth2 -j IMQ --todev 0
iptables -t mangle -A PREROUTING -i eth3 -j IMQ --todev 0

tc qdisc add dev imq0 root handle 10: htb default 20
tc class add dev imq0 parent 10: classid 10:2 \
 htb rate 512Kbit ceil 512Kbit
#####################################################
#class for eth1
tc class add dev imq0 parent 10:2 classid 10:21 htb rate 128Kbit ceil 
512Kbit
# mark
tc filter add dev imq0 parent 10:2 protocol ip prio 1 handle 1 fw 
classid 10:21
tc qdisc add dev imq0 parent 10:21 sfq perturb 15
#######################################################
# class for eth2
tc class add dev imq0 parent 10:2 classid 10:22 htb rate 128Kbit ceil 
512Kbit
#mark
tc filter add dev imq0 parent 10:2 protocol ip prio 1 handle 2 fw 
classid 10:22
tc qdisc add dev imq0 parent 10:22 sfq perturb 15
#########################################
# class for eth3
tc class add dev imq0 parent 10:2 classid 10:23 htb rate 128Kbit ceil 
512Kbit
#mark
tc filter add dev imq0 parent 10:2 protocol ip prio 1 handle 3 fw 
classid 10:23
tc qdisc add dev imq0 parent 10:23 sfq perturb 15
##############################################
##############################################
# outgoing traffic to eth1,eth2,eth3
#bring up  imq1
ip link set dev imq1 up
#make marks
iptables -t mangle -A markov2 -o eth1 -j MARK --set-mark 21
iptables -t mangle -A markov2 -o eth2 -j MARK --set-mark 22
iptables -t mangle -A markov2 -o eth3 -j MARK --set-mark 23
#forward it to imq1
iptables -t mangle -A POSTROUTING -o eth1 -j IMQ --todev 1
iptables -t mangle -A POSTROUTING -o eth2 -j IMQ --todev 1
iptables -t mangle -A POSTROUTING -o eth3 -j IMQ --todev 1

tc qdisc add dev imq1 root handle 10: htb default 20
tc class add dev imq1 parent 10: classid 10:2  htb rate 512Kbit ceil 512Kbit
##################################
# class for eth1
tc class add dev imq1 parent 10:2 classid 10:21 htb rate 128Kbit ceil 
512Kbit
# mark
tc filter add dev imq1 parent 10:2 protocol ip prio 1 handle 21 fw 
classid 10:21
tc qdisc add dev imq1 parent 10:21 sfq perturb 15
####################################
# class for eth2
tc class add dev imq1 parent 10:2 classid 10:22 htb rate 128Kbit ceil 
512Kbit
#mark
tc filter add dev imq1 parent 10:2 protocol ip prio 1 handle 22 fw 
classid 10:22
tc qdisc add dev imq1 parent 10:22 sfq perturb 15
#####################################
#class for eth3
tc class add dev imq1 parent 10:2 classid 10:23 htb rate 128Kbit ceil 
512Kbit
#mark
tc filter add dev imq1 parent 10:2 protocol ip prio 1 handle 23 fw 
classid 10:23
tc qdisc add dev imq1 parent 10:23 sfq perturb 15
######################################
######################################

But the traffic is unshaped, i think maybe somethink wrong with the 
filters becouse  if i do
tc -s class show dev imq0 or imq1 while uploading or downloading traffic 
doesnt get to right
class. If i take look in iptables -t mangle -L -n -v the packets are 
marked well
OUTPUT OF tc -s class show dev imq0
class htb 10:22 parent 10:2 leaf 8026: prio 0 rate 128000bit ceil 
512000bit burst 1615b cburst 1.625Kb
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 103424 ctokens: 26624

class htb 10:23 parent 10:2 leaf 8027: prio 0 rate 128000bit ceil 
512000bit burst 1615b cburst 1.625Kb
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 103424 ctokens: 26624
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
PARTIAL OUTPUT of iptables -t mangle -L -n -v
Chain markov (1 references)
 pkts bytes target     prot opt in     out     source               
destination
   96  8578 MARK       all  --  eth1   *       0.0.0.0/0            
0.0.0.0/0           MARK set 0x1
25004   36M MARK       all  --  eth2   *       0.0.0.0/0            
0.0.0.0/0           MARK set 0x2
    0     0 MARK       all  --  eth3   *       0.0.0.0/0            
0.0.0.0/0           MARK set 0x3

Chain markov2 (1 references)
 pkts bytes target     prot opt in     out     source               
destination
    7  1750 MARK       all  --  *      eth1    0.0.0.0/0            
0.0.0.0/0           MARK set 0x15
24874   36M MARK       all  --  *      eth2    0.0.0.0/0            
0.0.0.0/0           MARK set 0x16
    6  2222 MARK       all  --  *      eth3    0.0.0.0/0            
0.0.0.0/0           MARK set 0x17

class htb 10:2 root rate 512000bit ceil 512000bit burst 1.625Kb cburst 
1.625Kb
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 26624 ctokens: 26624

class htb 10:21 parent 10:2 leaf 8025: prio 0 rate 128000bit ceil 
512000bit burst 1615b cburst 1.625Kb
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 103424 ctokens: 26624
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
THANKS A LOT FOR HELP
Jorge Sanchez
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

             reply	other threads:[~2005-10-01  0:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-01  0:58 choros [this message]
2005-10-01 12:42 ` [LARTC] imq + htb Andy Furniss
2005-10-01 14:56 ` choros
  -- strict thread matches above, loose matches on Subject: below --
2003-07-01  5:40 [LARTC] IMQ & HTB Chijioke Kalu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=433DDF4D.4050306@inway.cz \
    --to=jorge@inway.cz \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.