Combination of tc-bfifo and iptables doesnt work

Linux Advanced Routing and Traffic Control

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

 




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=192.168.5.1
IPGU=192.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
--

--
To unsubscribe from this list: send the line "unsubscribe lartc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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