Re: [LARTC] incoming traffic??

Linux Advanced Routing and Traffic Control

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

 



On Sun, 11 May 2003 10:13:08 +0000, sun reflex4 <sunreflex4@xxxxxxxxxxx> wrote:

well, I have 2 interfaces, but I didn't get what you mean. You say I use one for incoming and one for outgoing? can this then be achieved only with iptables and tc?

Best greetings


Yes it can. Outgoing traffic can be shaped on your outgoing interface on your gateway. Incoming traffic is a little bit trickier - but if you have two interfaces you can use the interface that connects to your lan. Check http://www.docum.org/stef.coene/qos/kptd/ and you get a clue where to mark packets with iptables and then use tc and tc filter to do your shaping.


e.g. for download/incoming traffic:

#delete qdisc on dev
tc qdisc del dev $INTIF root 2>/dev/null
#new root qdisc
tc qdisc add dev $INTIF root handle 2:0 htb default 20
#some classes
tc class add dev $INTIF parent 2:0 classid 2:2 htb rate 10mbps ceil 101mbps
tc class add dev $INTIF parent 2:2 classid 2:20 htb rate 2000kbps ceil 101mbps prio 2 ...


or whatever qdiscs and classes and then:

#create a class for a single user for example
tc class add dev $INTIF parent 2:20 classid 2:2001 htb rate 1kbps ceil 200kbps
#mark his incoming traffic
/sbin/iptables -A POSTROUTING -t mangle -o $INTIF -p tcp --destination 192.168.1.1 -j MARK --set-mark 2001
#send all his incoming traffic to his class
tc filter add dev $INTIF parent 2:0 protocol ip handle 2001 fw flowid 2:2001


$INTIF is the interface, that connects to your lan. Dunno if it is all right what I wrote here fast. So you have to recheck before use. Hope it helps anyway.


Regards,


Graste

--
Using M2, Opera's new e-mail client.


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