From: Benjamin Kiessling Date: Mon, 13 May 2013 17:49:31 +0000 Subject: Re: pfifo_fast behavior. Message-Id: <20130513174931.GA3514@spatula.informatik.uni-leipzig.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw" List-Id: References: <518FA146.2070900@gmail.com> In-Reply-To: <518FA146.2070900@gmail.com> To: lartc@vger.kernel.org --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 05/12, dE wrote: > Hello everyone! >=20 > I was trying to do some traffic shaping to make http pages more responsive > while torrenting. So I decided to modify TOS value of packets to have an > affect on the default pfifo_fast qdisc. >=20 > I've the following iptable rules -- >=20 > #DNS request > iptables -t mangle -A OUTPUT -o eth1 -p udp -m multiport --dports 53 -j T= OS > --set-tos 0x10 >=20 > #DNS response > iptables -t mangle -A PREROUTING -i eth1 -p udp -m multiport --sports 53 = -j > TOS --set-tos 0x10 >=20 > #Incoming torrent connections > iptables -t mangle -A PREROUTING -i eth1 -p tcp -m multiport --dports 2000 > -j TOS --set-tos 0x2 > iptables -t mangle -A PREROUTING -i eth1 -p udp -m multiport --dports > 2000,1900,2001 -j TOS --set-tos 0x2 >=20 > #Mail server > iptables -t mangle -A OUTPUT -o eth1 -p tcp -d imap.googlemail.com -m > multiport --dports 993 -j TOS --set-tos 0x10 >=20 > #HTTP(S) > iptables -t mangle -A OUTPUT -o eth1 -p tcp -m multiport --dports 80,443 = -j > TOS --set-tos 0x14 > #iptables -t mangle -A OUTPUT -o eth1 -p tcp -m multiport --dports 80,443= -j > TOS --set-tos 0x10 > iptables -t mangle -A PREROUTING -i eth1 -p tcp -m multiport --sport 80,4= 43 > -j TOS --set-tos 0x14 > #iptables -t mangle -A PREROUTING -i eth1 -p tcp -m multiport --sport 80,= 443 > -j TOS --set-tos 0x10 There are several issues with your configuration. First, setting the (deprecated ToS) bits on incoming packets if you don't plan to forward these packets is senseless. Second, all *fifo* qdiscs are work-conserving, i.e. will dequeue packets at line speed. As the bandwidth of your local LAN is usually quite a bit higher than your internet uplink packets will still pile up at your DSL/cable/... modem. To actually prioritize services you need to own the queue by limiting your egress packet rate to slughtly lower than your modems rate. Be aware that most ISPs overcommit bandwidth in the order of 1:15-1:50 and your setup will still be ineffective if the shaped rate is higher than the modems rate. > But is there a difference between all TOS values which fall in a single > band? Nope.=20 > I mean, does the behavior of pfifo_fast change if I change from 0x12 to > 0x16? Cause I thought the qdisc to be simple, and a different behavior for > all of the above TOS values means pfifo_fast does a lot more than just > placing packets in 3 different queues. Nope. > Another question -- how do you get these TOS values? They are derived from [0]. Again ToS bits are deprecated. > and what does -j TOS --set-tos do? Does it modify the 4 bits > or the whole 8 bit TOS value in the header, or does something > completely different? Citing the manpage: "This module sets the Type of Service field in the IPv4 header (including the "precedence" bits) or the Priority field in the IPv6 header." It accesses the whole byte. Again ToS is deprecated. If you want to explicitely mark packet priorities in your network use DSCP (but don't forget admission control), otherwise just use iptables to match hosts/protocols directly to HTB/HFSC/DRR/... classes. Regards, Ben [0] https://tools.ietf.org/html/rfc1349 --GvXjxJ+pjyke8COw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJRkSerAAoJECylO89uSo7HcckQALeSwFi2RdussuzUFO60MMVw Ti7CZ+gUeitw/ab57WkzHzqpE3Q9Z6FvrqTII+1hvxBbO49+w+V5OGqjc5cESsHk q4PliFIcwfDIbxEAzMKeOMDgXX545BS0E97OTo1s++F52JSCLc9feV0qcAkRnjRH ZffgrOcxJQJd7woqeJSP8+txN+2OvokOebYMYd76hLDKDL603Gjbal1qMrVzHLbu SHbaULr3oJYlXwb5A1rFhnNw24AeljV16kKwKnqEoFZGf+7OAEL0Z5epGyco20Hm 7jp9TZ03bDcrn05mRzspjd7pUUENYag9tR0IIQQNavKAUliWaA/1ZA/Dw+Sxp4Jz gp64Iz/1SYXAw+uLl0sKKMNCJDWAXccdpRafhLqfQfPPeUHnKw4RA4pIOZW1gfLi HqYtdyox/uXb5tSd16a4+3x4yGGGFgko8ir1hsI5B8Fi5+JjcOPlfnZOiloC4Vc9 fp+Q495CWko03lflDerAj3TfFuMkXTCdwAK9NHj1xEe+8vHoF/7xMhD34VOc1uJo akAGcC9P42eqs7afgqEEb/e7mXDZeBftvyvEO8VXqDfOj2VYlb1SbC+1q5oSGE96 IP9CEIxn2LDRVx69ghM0Sfu21wKGEmO+tztshRuD76wepXVDoATNJlXbqgqJTQ6E zljBB7T0bRejhxRXpHe9 =VjRg -----END PGP SIGNATURE----- --GvXjxJ+pjyke8COw--