5 # WARNING! Remember to put '$true' in any function you intend to leave empty
6 # (e.g. you don't need to use the 'custom_variables' function)
7 # to make sure the script doesn't break.
17 sv6
="`which stripipv6`"
18 iptables
="`which iptables`"
19 modprobe
="`which modprobe`"
24 # define whatever you need here
26 ### interfaces to redirect traffic from
27 if_to_redir
=(vlan334 vlan364 eth1 eth2
)
29 ### HTB specific settings
32 ### router total uplink and downlink (e.g. 100mbit for FastEthernet)
33 global_outgoing
="100mbit"
34 global_incoming
="100mbit"
43 ### load the ifb module...
50 # ...bring the interfaces up...
56 # ...and set up root queues on them
57 $tc qdisc add dev
$ctr1 root handle
1:0 htb
60 # also, set total badwidth available for the interfaces
61 $tc class add dev ifb0 parent
1:0 classid
1:1 htb \
62 rate
$global_incoming quantum
$quantum
64 $tc class add dev ifb1 parent
1:0 classid
1:1 htb \
65 rate
$global_outgoing quantum
$quantum
69 ### redirect all incoming and outgoing traffic to ifb0 and ifb1
70 for ctr1
in ${if_to_redir[*]}
73 $tc qdisc add dev
$ctr1 ingress handle ffff
:
75 $tc filter add dev
$ctr1 parent ffff
: protocol ip u32 \
76 match u32
0 0 action mirred egress redirect dev ifb0 \
77 2> /dev
/null
> /dev
/null
80 $tc qdisc add dev
$ctr1 root handle
1:0 htb
82 $tc filter add dev
$ctr1 parent
1:0 protocol ip u32 \
83 match u32
0 0 action mirred egress redirect dev ifb1 \
84 2> /dev
/null
> /dev
/null
96 for ctr2
in ifb0 ifb1
${if_to_redir[*]}
98 $tc qdisc del root dev
$ctr2
101 for ctr3
in ${if_to_redir[*]}
103 $tc qdisc del dev
$ctr3 ingress