- All the traffic generated by 10.0.2.1 should go to 10.0.2.11, If the destination of this traffic is internet than it should be placed on its interface eth1. Outgoing traffic on eth1 should be shaped.For this I am using fw filters and cbq.
_______
10.0.2.1 -------> 10.0.2.11(eth0 )----| A |----- 10.0.2.22(eth1)
-----------
On machine "A" , I run following commands:
## mark all the traffic coming from 10.0.2.1 by 1 ##
iptables -t mangle -A PREROUTING -i eth0 -s 10.0.2.1 -j MARK --set-mark 1
## add route for traffic destined to internet ## add route $Internet_Address dev eth1
## Configure following policy ##
1:0 (10Mbit) | 1:1 (10 Mbit) / \ 1:2 1:3 (110Kbit) (100Kbit, bounded)
## add queuing discipline and classes to eth1 ##
1. tc qdisc del dev eth1 root cbq bandwidth 10Mbit avpkt 1000
2. tc qdisc add dev eth1 root handle 1:0 cbq bandwidth 10Mbit avpkt 1000
3. tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 10Mbit rate 10Mbit allot 1514 avpkt 1000 weight 1Mbit
4. tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 10Mbit rate 100Kbit allot 1514 avpkt 1000 weight 10Kbit bounded
5. tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth 10Mbit rate 110Kbit allot 1514 avpkt 1000 weight 11Kbit
6. tc filter add dev eth1 protocol ip parent 1:0 prio 1 handle 1 fw classid 1:2
Now when I run=> tc -s class show dev eth1 parent 1:0 I get:
class cbq 1: root rate 10Mbit (bounded,isolated) prio no-transmit
Sent 42 bytes 1 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 624 undertime 0
class cbq 1:1 parent 1: rate 10Mbit prio no-transmit
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 0 undertime 0
class cbq 1:2 parent 1:1 rate 100Kbit (bounded) prio no-transmit
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 0 undertime 0
class cbq 1:3 parent 1:1 rate 110Kbit prio no-transmit
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 0 undertime 0
Now irrespective of the amount of traffic generated by 10.0.2.1, the sent bytes in class cbq 1:
remains 42 also no traffic is categorized for class 1:2 why????
___________________________________________________ Click below to experience Sooraj R Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek & Kareena http://www.mpkdh.com