lartc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ηλια Χατζηστυλη" <iliachat1@ee.duth.gr>
To: lartc@vger.kernel.org
Subject: Combination of tc-bfifo and iptables doesnt work
Date: Mon, 25 Apr 2016 12:26:04 +0000	[thread overview]
Message-ID: <20160425152604.Horde.U0hDTRuRyDfWlX2AeGGqW1b@ermis.noc.duth.gr> (raw)


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
--


             reply	other threads:[~2016-04-25 12:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25 12:26 Ηλια Χατζηστυλη [this message]
2016-04-25 15:12 ` Combination of tc-bfifo and iptables doesnt work Martin A. Brown
2016-04-25 21:41 ` Alan Goodman

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=20160425152604.Horde.U0hDTRuRyDfWlX2AeGGqW1b@ermis.noc.duth.gr \
    --to=iliachat1@ee.duth.gr \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).