From: Alexander Samad Date: Thu, 12 May 2005 08:31:51 +0000 Subject: Re: [LARTC] IPTables script Message-Id: <20050512083151.GB19998@samad.com.au> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1771780975==" List-Id: References: <200505121414.56363.lartc-337@ccp.com.au> In-Reply-To: <200505121414.56363.lartc-337@ccp.com.au> To: lartc@vger.kernel.org --===============1771780975== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DBIVS5p969aUjpLe" Content-Disposition: inline --DBIVS5p969aUjpLe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 12, 2005 at 09:40:56AM +0200, Sylvain BERTRAND wrote: > On Jeu 12 mai 2005 8:14, Lee Sanders a ?crit : > > Hi All, > > > > I've been playing with QOS for a short while now and have worked out how > > to do > > what I want using HTB. Great queuing discipline btw. > > > > My problem is the tc filters I want to setup aren't working because > > iptables is getting to the packets first and mangling the src address. > > > > The iptables script I am using is MonMotha's Firewall 2.3.8 and it > > includes > > lots of nice goodies like syn flood rate limiting. The extra bits like > > this > > are why I'm using it rather than figuring the iptables configuration out > > myself. > > > > My network configuration is trivial, adsl router connected to linux box > > connected to two networks, LAN and WLAN. > > > > I like having these iptables features but MonMotha's Firewall isn't > > designed > > with QOS in mind. > > > > My question for this list, is there a recommended iptables router script > > that > > everyone here uses designed with QOS in mind or have you all written yo= ur > > own ? > > > > Thanks in Advance > > > > Lee > > >=20 > Hi Lee, >=20 > Below is my script. It's inspired from LARTC, for the same configuration > as you : home Linux routeur with DSL on eth1, masquerading trafic from > LAN. The server is running a few services (http,mail,dns), and I want > these services to have priority, and also the users must have priority for > their mail & http over the default class. The trafic to/from the services > not defined below goes to default class, which is fine (ftp, im, ...). > Hope you can use it, though it's certainly not perfect. >=20 > Sylvain >=20 Sylvain Q) why use do your matching in tc filter and not netfilter ? Is one way better than the other. I started out doing it via filter and then moved to netfilter instead using mark. Curious to hear what other people have/do do Alex >=20 > #!/bin/bash >=20 > UPLINK_EXT=3D950 # outgoing DSL bandwidth, kbps > DEV_EXT=3Deth1 # DSL link >=20 > tc qdisc del dev ${DEV_EXT} root 2> /dev/null > /dev/null >=20 > tc qdisc add dev ${DEV_EXT} root handle 1: htb default 20 >=20 > # root class > tc class add dev ${DEV_EXT} parent 1: classid 1:1 htb rate > $[${UPLINK_EXT}]kbit prio 0 > # fast ( 80% ) > tc class add dev ${DEV_EXT} parent 1:1 classid 1:10 htb rate > $[8*${UPLINK_EXT}/10]kbit ceil $[${UPLINK_EXT}]kbit burst 10k prio 1 > # slow ( 20% ) > tc class add dev ${DEV_EXT} parent 1:1 classid 1:20 htb rate > $[2*${UPLINK_EXT}/10]kbit ceil $[8*${UPLINK_EXT}/10]kbit burst 2k prio 5 >=20 > # stochastic fairness > tc qdisc add dev ${DEV_EXT} parent 1:10 handle 10: sfq perturb 10 > tc qdisc add dev ${DEV_EXT} parent 1:20 handle 20: sfq perturb 10 >=20 > # trafic with priority > # CLIENT > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 22 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 25 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 53 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 80 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 110 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 143 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 443 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 993 0xffff flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 995 0xffff flowid 1:10 > # SERVER > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > sport 22 0xfffd flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > sport 25 0xfffd flowid 1:10 > tc filter add dev ${DEV_EXT} protocol ip parent 1: prio 4 u32 match ip > dport 53 0xffff flowid 1:10 >=20 >=20 > _______________________________________________ > LARTC mailing list > LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc >=20 --DBIVS5p969aUjpLe Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFCgxR3kZz88chpJ2MRAlOzAJ90Iyoms0jATLsyWbCT8Q1X+JJqvACfTKJJ QSPU15jqaFUGtEqz+ElkyFg= =lDvn -----END PGP SIGNATURE----- --DBIVS5p969aUjpLe-- --===============1771780975== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============1771780975==--