dnscrypto-proxy: Update to release 1.3.0
[tomato.git] / release / src / router / iproute2 / examples / diffserv / Edge2
blob2f78da24e1e77aa4af5c5015c7fd864dc12082b4
1 #! /bin/sh -x
3 # sample script on using the ingress capabilities
4 # This script tags the fwmark on the ingress interface using IPchains
5 # the result is used first for policing on the Ingress interface then
6 # for fast classification and re-marking
7 # on the egress interface
9 #path to various utilities;
10 #change to reflect yours.
12 IPROUTE=/root/DS-6-beta/iproute2-990530-dsing
13 TC=$IPROUTE/tc/tc
14 IP=$IPROUTE/ip/ip
15 IPCHAINS=/root/DS-6-beta/ipchains-1.3.9/ipchains
16 INDEV=eth2
17 EGDEV="dev eth1"
19 # tag all incoming packets from host 10.2.0.24 to value 1
20 # tag all incoming packets from host 10.2.0.3 to value 2
21 # tag the rest of incoming packets from subnet 10.2.0.0/24 to value 3
22 #These values are used in the egress
23 ############################################################
24 $IPCHAINS -A input -s 10.2.0.0/24 -m 3
25 $IPCHAINS -A input -i $INDEV -s 10.2.0.24 -m 1
26 $IPCHAINS -A input -i $INDEV -s 10.2.0.3 -m 2
27 ############################################################
29 # install the ingress qdisc on the ingress interface
30 ############################################################
31 $TC qdisc add dev $INDEV handle ffff: ingress
32 ############################################################
35 # attach a fw classifier to the ingress which polices anything marked
36 # by ipchains to tag value 3 (The rest of the subnet packets -- not
37 # tag 1 or 2) to not go beyond 1.5Mbps
38 # Allow up to at least 60 packets to burst (assuming maximum packet
39 # size of # 1.5 KB) in the long run and upto about 6 packets in the
40 # shot run
42 ############################################################
43 $TC filter add dev $INDEV parent ffff: protocol ip prio 50 handle 3 fw \
44 police rate 1500kbit burst 90k mtu 9k drop flowid :1
45 ############################################################
47 ######################## Egress side ########################
50 # attach a dsmarker
52 $TC qdisc add $EGDEV handle 1:0 root dsmark indices 64
54 # values of the DSCP to change depending on the class
56 $TC class change $EGDEV classid 1:1 dsmark mask 0x3 \
57 value 0xb8
58 $TC class change $EGDEV classid 1:2 dsmark mask 0x3 \
59 value 0x28
60 $TC class change $EGDEV classid 1:3 dsmark mask 0x3 \
61 value 0x48
64 # The class mapping
66 $TC filter add $EGDEV parent 1:0 protocol ip prio 4 handle 1 fw classid 1:1
67 $TC filter add $EGDEV parent 1:0 protocol ip prio 4 handle 2 fw classid 1:2
68 $TC filter add $EGDEV parent 1:0 protocol ip prio 4 handle 3 fw classid 1:3
72 echo "---- qdisc parameters Ingress ----------"
73 $TC qdisc ls dev $INDEV
74 echo "---- Class parameters Ingress ----------"
75 $TC class ls dev $INDEV
76 echo "---- filter parameters Ingress ----------"
77 $TC filter ls dev $INDEV parent ffff:
79 echo "---- qdisc parameters Egress ----------"
80 $TC qdisc ls $EGDEV
81 echo "---- Class parameters Egress ----------"
82 $TC class ls $EGDEV
83 echo "---- filter parameters Egress ----------"
84 $TC filter ls $EGDEV parent 1:0
86 #deleting the ingress qdisc
87 #$TC qdisc del $DEV ingress