public inbox for lartc@vger.kernel.org
 help / color / mirror / Atom feed
* Combination of tc-bfifo and iptables doesnt work
@ 2016-04-25 12:26 Ηλια Χατζηστυλη
  2016-04-25 15:12 ` Martin A. Brown
  2016-04-25 21:41 ` Alan Goodman
  0 siblings, 2 replies; 3+ messages in thread
From: Ηλια Χατζηστυλη @ 2016-04-25 12:26 UTC (permalink / raw)
  To: lartc


Hello.
I have an openwrt firmware installed in my router and I want to  
configure a Home and a Guest interface.
So I have two internal interfaces(home,guest) and the external(eth1).  
First I have to send all traffic from the two internal interfaces to  
external(eth1) so that I can use one qdisc with classes which can  
borrow rate from each other. Subsequently, I want to use the Tc-prio  
tool to apply priority queuing and then I also want to limit the rate  
of the external qdisc(eth1), so I use tbf scheduler ,as shown below.  
It is very important for my project to define home and guest queues in  
bytes and not in packets so I want to use BFIFO in my 3 prioritized  
auto created classes and not pfifo_Fast and ifconfig method. So when I  
add the 3 last lines of code the two internal interfaces do not have  
network access, so I suppose that the iptables commands doesn't work  
any more. Is it possible for you to point the problem here?

Thank you in advance,
Chatzistyli Ilia

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

echo "Starting bandwidth shaping"
IPT=/usr/sbin/iptables
IF=eth1
#interface home user
IFHU=wlan0
#interface guest user
IFGU=wlan0-1
IP="$(ifconfig eth1 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' '  
-f 1)"    # IP eth1 Interface
IPHU\x192.168.5.1
IPGU\x192.168.3.1



$IPT -t filter -F
$IPT -t filter -X
$IPT -t nat -F
$IPT -t nat -X
$IPT -t mangle -F
$IPT -t mangle -X
$IPT -t raw -F
$IPT -t raw -X
# Default Policies fuer integrierte Ketten festlegen:

$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
$IPT -t nat -P OUTPUT ACCEPT
$IPT -t filter -P INPUT ACCEPT
$IPT -t filter -P FORWARD ACCEPT
$IPT -t filter -P OUTPUT ACCEPT

#----------send wlan0-1 & wlan0 to eth1
         echo "iptables interface traffic redirect"
         iptables -t nat -A POSTROUTING --out-interface $IF -j MASQUERADE
         iptables -A FORWARD --in-interface $IFHU -j CLASSIFY --set-class 2:1
         iptables -A FORWARD --in-interface $IFGU -j CLASSIFY --set-class 2:2
         echo "end of iptables"
#--------------------------------------

#----------clean prev rules always-----
         echo "clearing old qdiscs"
         tc qdisc del dev $IF root
         echo "end of cleaning"

#----------------------u32 for up limit
         echo "tc-start"
         echo "qdisc"
         tc qdisc add dev $IF root handle 1: tbf rate 690kbit burst  
2750 limit 50000
         tc qdisc add dev $IF parent 1: handle 2: prio
         echo "class 1(home) 2(guest)"

#-------------------- This *instantly* creates classes 2:1, 2:2, 2:3

        tc qdisc add dev $IF parent 2:1 handle 10 bfifo limit 60
        tc qdisc add dev $IF parent 2:2 handle 20 bfifo limit 60
        tc qdisc add dev $IF parent 2:3 handle 30 bfifo limit 60
--


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-25 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25 12:26 Combination of tc-bfifo and iptables doesnt work Ηλια Χατζηστυλη
2016-04-25 15:12 ` Martin A. Brown
2016-04-25 21:41 ` Alan Goodman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox