Daer all, Is it possible to do DSCP remarking + GRED at one go using tc? The examples that I found on the Net is either doing DSCP remark or GRED but not both. I have read the IETF draft draft-almesberger-wajhak-diffserv-linux-00.txt @ http://snafu.freedom.org/linux2.2/docs/draft-almesberger-wajhak-diffserv-linux-00.txt and it mentioned in Figure 7 that it is possible to change the DS field. Can anyone enlighten me? :-) Thanks and Regards, Titus _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Hi Titus, I just tried this, and it seems you can. See script below. I did it quite quickly, so there may be an error somewhere - every 30 seconds or so it prints out an error on the commandline (something like - dsmark_dequeue: unsupported protocol 2054), but it remarks packets correctly, and then enqueues them in the right place, so it is functional. The basic idea is use the root dsmark qdisc to remark packets as usual. As a child to this set up another dsmark qdisc which matches packets using tcindex as usual, and within this qdisc set up your classful qdisc, and GRED... Regards, James ==================================================== #!/bin/bash #Test to see if you can mark and use GRED with dsmark simultaneously. #Takes outgoing HTTP traffic, marks it af11 and queues it in GRED DEV=''eth0'' tc qdisc del dev $DEV root #DSMARK - for marking tc qdisc add dev $DEV root handle 1:0 dsmark indices 64 #Marking classes tc class change dev $DEV parent 1:0 classid 1:1 dsmark mask 0x3 value 0x28 tc class change dev $DEV parent 1:0 classid 1:2 dsmark mask 0x3 value 0x0 #Filters - second one matches everything the first one missed tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 match ip dport 80 0xffff flowid 1:1 tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip tos 0x0 0x0 classid 1:2 #DSMARK - matching on DSCP tc qdisc add dev $DEV parent 1: handle 2: dsmark indices 64 default_index 0x1 set_tc_index #Filter to get DSCP from TOS tc filter add dev $DEV parent 2: protocol ip prio 1 tcindex mask 0xfc shift 2 pass_on #Sets tcindex of packets marked af11 to 1 tc filter add dev $DEV parent 2: protocol ip prio 1 handle 0x0a tcindex classid 2:1 #HTB tc qdisc add dev $DEV parent 2: handle 3: htb default 20 #This class allows sharing of bandwidth (note the b/ws are random figures) tc class add dev $DEV parent 3: classid 3:1 htb rate 300kbit burst 20kbit #Leaf classes tc class add dev $DEV parent 3:1 classid 3:10 htb rate 100kbit burst 20kbit tc class add dev $DEV parent 3:1 classid 3:20 htb rate 200kbit burst 20kbit #Leaf qdisc - GRED tc qdisc add dev $DEV parent 3:10 gred setup DPs 3 default 2 grio tc qdisc change dev $DEV parent 3:10 gred limit 60KB min 15KB max 45KB burst 20 avpkt 1000 bandwidth 300kbit DP 1 probability 0.02 prio 2 tc qdisc change dev $DEV parent 3:10 gred limit 60KB min 15KB max 45KB burst 20 avpkt 1000 bandwidth 300kbit DP 2 probability 0.04 prio 3 tc qdisc change dev $DEV parent 3:10 gred limit 60KB min 15KB max 45KB burst 20 avpkt 1000 bandwidth 300kbit DP 0 probability 0.06 prio 4 #Leaf filter - best effort defaults to class 3:20 tc filter add dev $DEV parent 3:0 protocol ip prio 1 handle 1 tcindex classid 3:10 ====================================================> -----Original Message----- > From: Hoon Titus [mailto:hoontitu@comp.nus.edu.sg] > Sent: 31 March 2003 11:41 > To: lartc@mailman.ds9a.nl > Subject: [LARTC] DSCP remarking + GRED at one go? > > > Daer all, > > Is it possible to do DSCP remarking + GRED at one go using tc? > > The examples that I found on the Net is either doing DSCP > remark or GRED > but not both. > > I have read the IETF draft > draft-almesberger-wajhak-diffserv-linux-00.txt > @ > http://snafu.freedom.org/linux2.2/docs/draft-almesberger-wajha > k-diffserv-linux-00.txt > and it mentioned in Figure 7 that it is possible to change > the DS field. > > Can anyone enlighten me? :-) > > Thanks and Regards, > Titus > > > > _______________________________________________ > LARTC mailing list / LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/ >The Information contained in this E-Mail and any subsequent correspondence is private and is intended solely for the intended recipient(s). For those other than the recipient any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on such information is prohibited and may be unlawful. Emails and other electronic communication with QinetiQ may be monitored. Calls to our Customer Contact Centre may be recorded for quality control, regulatory and monitoring purposes. _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Hi everyone, Thanks for the reply. Sad to say but Jame''s script doesn''t work on my system :-(. Is it because my kernel is too old? I have to keep it as i can''t configure mrouted to work on 2.4 kernel. My router config: 2 NIC eth0 and eth1 2.2 kernel + DS8 patch + iproute2 2.2.4 + mrouted I suspect the line "tc qdisc add dev eth0 handle 2:0 root dsmark indices 64 set_tc_index" which setup the 2nd DSMARK caused all the problem: -------------------------------->8----------------------------------------- #!/bin/bash echo ''Init tc..'' #clear old entries tc qdisc del dev eth0 handle 1:0 root dsmark indices 64 > /dev/null #starts here tc qdisc add dev eth0 handle 1:0 root dsmark indices 64 #setup the lookup table echo ''Setup tc class..'' tc class change dev eth0 classid 1:1 dsmark mask 0x3 value 0x28 tc class change dev eth0 classid 1:2 dsmark mask 0x3 value 0x30 tc class change dev eth0 classid 1:3 dsmark mask 0x3 value 0x00 #setup the priority echo ''Setup tc filter priority..'' tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1: u32 divisor 1 tc filter add dev eth0 parent 1:0 protocol ip prio 5 handle 2: u32 divisor 1 #Mcast layers - marked AF11 and AF12 accordingly # AF11 to class id 1:1 # AF12 to class id 1:2 echo ''Filter according to MCast addr..'' tc filter add dev eth0 parent 1:0 prio 4 u32 match ip dst 225.1.1.1/32 flowid 1:1 tc filter add dev eth0 parent 1:0 prio 5 u32 match ip dst 225.1.1.6/32 flowid 1:2 # the rest of packets ends up with DSMARK 0x00 tc filter add dev eth0 parent 1:0 prio 5 u32 match ip dst 0.0.0.0/0 flowid 1:3 # handle 2:0 # --- General setup --- tc qdisc add dev eth0 handle 2:0 root dsmark indices 64 set_tc_index ..... (the remaing lines are commented and as i found the tc qdisc add line has caused the problem) --------------------------------------------------------------------------- Once the 2nd DSMARK is added, the entire remarking system failed to work. I have also have to add in the lines "tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1: u32 divisor 1" "tc filter add dev eth0 parent 1:0 protocol ip prio 5 handle 2: u32 divisor 1" in order to use the remarking facility provided. Can anyone please point out what''s wrong (or any kernel limitation)? Thanks and Regards, Titus _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Is there also a DSCP patch for the 2.4 kernel so I can use policy routing on DSCP fields in stead of on TOS fields? Rinse ----- Original Message ----- From: "Hoon Titus" <hoontitu@comp.nus.edu.sg> To: <lartc@mailman.ds9a.nl> Sent: Tuesday, April 01, 2003 7:05 AM Subject: RE: [LARTC] DSCP remarking + GRED at one go?> Hi everyone, > > Thanks for the reply. > > Sad to say but Jame''s script doesn''t work on my system :-(. Is it because > my kernel is too old? I have to keep it as i can''t configure mrouted to > work on 2.4 kernel. > > My router config: 2 NIC eth0 and eth1 > 2.2 kernel + DS8 patch + iproute2 2.2.4 + mrouted > > I suspect the line "tc qdisc add dev eth0 handle 2:0 root dsmark indices > 64 set_tc_index" which setup the 2nd DSMARK caused all the problem: > -------------------------------->8-----------------------------------------> #!/bin/bash > > echo ''Init tc..'' > #clear old entries > tc qdisc del dev eth0 handle 1:0 root dsmark indices 64 > /dev/null > > #starts here > tc qdisc add dev eth0 handle 1:0 root dsmark indices 64 > > #setup the lookup table > echo ''Setup tc class..'' > tc class change dev eth0 classid 1:1 dsmark mask 0x3 value 0x28 > tc class change dev eth0 classid 1:2 dsmark mask 0x3 value 0x30 > tc class change dev eth0 classid 1:3 dsmark mask 0x3 value 0x00 > > #setup the priority > echo ''Setup tc filter priority..'' > tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1: u32 divisor1> tc filter add dev eth0 parent 1:0 protocol ip prio 5 handle 2: u32 divisor1> > #Mcast layers - marked AF11 and AF12 accordingly > # AF11 to class id 1:1 > # AF12 to class id 1:2 > echo ''Filter according to MCast addr..'' > tc filter add dev eth0 parent 1:0 prio 4 u32 match ip dst 225.1.1.1/32 > flowid 1:1 > tc filter add dev eth0 parent 1:0 prio 5 u32 match ip dst 225.1.1.6/32 > flowid 1:2 > > # the rest of packets ends up with DSMARK 0x00 > tc filter add dev eth0 parent 1:0 prio 5 u32 match ip dst 0.0.0.0/0 flowid > 1:3 > > # handle 2:0 > # --- General setup --- > tc qdisc add dev eth0 handle 2:0 root dsmark indices 64 set_tc_index > ..... > (the remaing lines are commented and as i found the tc qdisc add line has > caused the problem) > ---------------------------------------------------------------------------> > Once the 2nd DSMARK is added, the entire remarking system failed to work. > I have also have to add in the lines > "tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1: u32 > divisor 1" > "tc filter add dev eth0 parent 1:0 protocol ip prio 5 handle 2: u32 > divisor 1" > in order to use the remarking facility provided. > > Can anyone please point out what''s wrong (or any kernel limitation)? > > Thanks and Regards, > Titus > > > > _______________________________________________ > LARTC mailing list / LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/ >_______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Dear all, After testing the script on RH8 (kernel 2.4), I realized that the problem actually lies with the set_tc_index of the dsmark with handle 2:0 once that option is added, the remarking in the first dsmark fails. James uses the default_index to get around with this but i can''t as i have to remark 2 groups of packets - 1 group to AF11 and another group with AF12. Can anyone suggest something? Thanks and Regards, Titus _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/